Showing posts with label basicly. Show all posts
Showing posts with label basicly. Show all posts

Friday, March 23, 2012

it helps, but still have some questions

thank you, guys. Your reply really help me. Now, basicly, I'm clear about
these technical terms. But not sure the following questions:
1. How do I know whether my sql server is in Simple Mode or not?
2. Does the full database backup include the last lsn? I try to understand
how the system works. when I restore data using the full database backup
with a trans log backup, the system will firstly restore the data in the
full backup, next, it will take out the transactions from the trans log
backup that time is later than the last lsn, and do all these trans so that
all data can be restored.
3. My database is not big, I think it will under 2GB. I got a plan, but
don't know is't a good one. I will do a full backup 1 time per month, and
1 time differential database backup per day, and then 1 time trans backup
per hour. Is it suitable for me?
oh, I really sorry for my poor English, even me has been confused by my
words, but I've try my best. Hope you will know what I say. Here some recommendations:
1) Right-click your database and select Properties, then on Options look for
Recovery model.
2) For a database under 2GB, I would definitelly do a daily full backup,
perhaps at night, or when the number of transactions is low or minimum. If
this works fine for you, then you do not need a differential backup, only
transaction log backups in addition to the daily full backup.
Ben Nevarez, MCDBA, OCP
"mizi" <haha@.haha.com> wrote in message
news:Xns9718C5C08B547hahahahacom@.207.46.248.16...
> thank you, guys. Your reply really help me. Now, basicly, I'm clear about
> these technical terms. But not sure the following questions:
> 1. How do I know whether my sql server is in Simple Mode or not?
> 2. Does the full database backup include the last lsn? I try to understand
> how the system works. when I restore data using the full database backup
> with a trans log backup, the system will firstly restore the data in the
> full backup, next, it will take out the transactions from the trans log
> backup that time is later than the last lsn, and do all these trans so
> that
> all data can be restored.
> 3. My database is not big, I think it will under 2GB. I got a plan, but
> don't know is't a good one. I will do a full backup 1 time per month, and
> 1 time differential database backup per day, and then 1 time trans backup
> per hour. Is it suitable for me?
> oh, I really sorry for my poor English, even me has been confused by my
> words, but I've try my best. Hope you will know what I say.

it helps, but still have some questions

thank you, guys. Your reply really help me. Now, basicly, I'm clear about
these technical terms. But not sure the following questions:
1. How do I know whether my sql server is in Simple Mode or not?
2. Does the full database backup include the last lsn? I try to understand
how the system works. when I restore data using the full database backup
with a trans log backup, the system will firstly restore the data in the
full backup, next, it will take out the transactions from the trans log
backup that time is later than the last lsn, and do all these trans so that
all data can be restored.
3. My database is not big, I think it will under 2GB. I got a plan, but
don't know is't a good one. I will do a full backup 1 time per month, and
1 time differential database backup per day, and then 1 time trans backup
per hour. Is it suitable for me?
oh, I really sorry for my poor English, even me has been confused by my
words, but I've try my best. Hope you will know what I say.
Here some recommendations:
1) Right-click your database and select Properties, then on Options look for
Recovery model.
2) For a database under 2GB, I would definitelly do a daily full backup,
perhaps at night, or when the number of transactions is low or minimum. If
this works fine for you, then you do not need a differential backup, only
transaction log backups in addition to the daily full backup.
Ben Nevarez, MCDBA, OCP
"mizi" <haha@.haha.com> wrote in message
news:Xns9718C5C08B547hahahahacom@.207.46.248.16...
> thank you, guys. Your reply really help me. Now, basicly, I'm clear about
> these technical terms. But not sure the following questions:
> 1. How do I know whether my sql server is in Simple Mode or not?
> 2. Does the full database backup include the last lsn? I try to understand
> how the system works. when I restore data using the full database backup
> with a trans log backup, the system will firstly restore the data in the
> full backup, next, it will take out the transactions from the trans log
> backup that time is later than the last lsn, and do all these trans so
> that
> all data can be restored.
> 3. My database is not big, I think it will under 2GB. I got a plan, but
> don't know is't a good one. I will do a full backup 1 time per month, and
> 1 time differential database backup per day, and then 1 time trans backup
> per hour. Is it suitable for me?
> oh, I really sorry for my poor English, even me has been confused by my
> words, but I've try my best. Hope you will know what I say.
sql

it helps, but still have some questions

thank you, guys. Your reply really help me. Now, basicly, I'm clear about
these technical terms. But not sure the following questions:
1. How do I know whether my sql server is in Simple Mode or not?
2. Does the full database backup include the last lsn? I try to understand
how the system works. when I restore data using the full database backup
with a trans log backup, the system will firstly restore the data in the
full backup, next, it will take out the transactions from the trans log
backup that time is later than the last lsn, and do all these trans so that
all data can be restored.
3. My database is not big, I think it will under 2GB. I got a plan, but
don't know is't a good one. I will do a full backup 1 time per month, and
1 time differential database backup per day, and then 1 time trans backup
per hour. Is it suitable for me?
oh, I really sorry for my poor English, even me has been confused by my
words, but I've try my best. Hope you will know what I say. :)Here some recommendations:
1) Right-click your database and select Properties, then on Options look for
Recovery model.
2) For a database under 2GB, I would definitelly do a daily full backup,
perhaps at night, or when the number of transactions is low or minimum. If
this works fine for you, then you do not need a differential backup, only
transaction log backups in addition to the daily full backup.
Ben Nevarez, MCDBA, OCP
"mizi" <haha@.haha.com> wrote in message
news:Xns9718C5C08B547hahahahacom@.207.46.248.16...
> thank you, guys. Your reply really help me. Now, basicly, I'm clear about
> these technical terms. But not sure the following questions:
> 1. How do I know whether my sql server is in Simple Mode or not?
> 2. Does the full database backup include the last lsn? I try to understand
> how the system works. when I restore data using the full database backup
> with a trans log backup, the system will firstly restore the data in the
> full backup, next, it will take out the transactions from the trans log
> backup that time is later than the last lsn, and do all these trans so
> that
> all data can be restored.
> 3. My database is not big, I think it will under 2GB. I got a plan, but
> don't know is't a good one. I will do a full backup 1 time per month, and
> 1 time differential database backup per day, and then 1 time trans backup
> per hour. Is it suitable for me?
> oh, I really sorry for my poor English, even me has been confused by my
> words, but I've try my best. Hope you will know what I say. :)

Monday, March 12, 2012

Issue with SQLDataSource and FilterExpression

I'm not sure exactly how the FilterExpression works. I have a sqldatasource, stored procedure, and GridView. My stored procedure basicly a select statement to populate my gridview, it included the fields I want to filter on. In my codebehind file I build a WHERE Clause based on the entries a user makes. Then I add the my FilterExpr variable to the SqlDataSource1.FilterExpression = FilterExpr. My SqlDataSource has a number of control parameters that match the textboxes a users enters into.

My question, I guess is does my stored procedure need the variables matching my controlparameters for my sqldatasource? Or how does this work? My GridView is returning all rows no matter what I enter into the filter textboxes (first, last, etc...)

MY SQLSDATASOURCE

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString%>" SelectCommand="ClientSearch" SelectCommandType="StoredProcedure"> <FilterParameters> <asp:ControlParameter ControlID="SearchLastName" Name="LastName" PropertyName="Text" ConvertEmptyStringToNull="true" /> <asp:ControlParameter ControlID="SearchFirstName" Name="FirstName" PropertyName="Text" ConvertEmptyStringToNull="true" /> <asp:ControlParameter ControlID="SearchEmail" Name="Email" PropertyName="Text" ConvertEmptyStringToNull="true" /> <asp:ControlParameter ControlID="SearchAddress" Name="Address" PropertyName="Text" ConvertEmptyStringToNull="true" /> <asp:ControlParameter ControlID="SearchComment" Name="Comment" PropertyName="Text" ConvertEmptyStringToNull="true" /> </FilterParameters> </asp:SqlDataSource>
MY CODEBEHIND

Dim FilterExprAs String

If SearchLastName.Text =""And _
SearchFirstName.Text =""And _
SearchEmail.Text =""And _
SearchComment.Text =""And _
SearchAddress.Text =""Then
lblMessage.Text ="You didn't enter any search parameters. Please try Again."
Me.GridViewSearch.DataSourceID = ""
Exit Sub
Else
Me.GridViewSearch.DataSourceID = "SqlDataSource1"
End If

FilterExpr = ""
If SearchLastName.Text <> "" Then
FilterExpr = FilterExpr & "LastNameLike'" & _
SearchLastName.Text &"%" &"' AND "
End If

If SearchFirstName.Text <> "" Then
FilterExpr = FilterExpr & "FirstNameLike'" & _
SearchFirstName.Text &"%" &"' AND "
End If
If SearchEmail.Text <> "" Then
FilterExpr = FilterExpr & "EmailLike'" & _
SearchEmail.Text &"%" &"' AND "
End If
If SearchComment.Text <> "" Then
FilterExpr = FilterExpr & "[Comments]Like'" & "%" & _
SearchComment.Text &"%" &"' AND "
End If
If SearchAddress.Text <> "" Then
FilterExpr = FilterExpr & "[Address]Like'" & "%" & _
SearchAddress.Text &"%" &"' AND "
End If

If Right(FilterExpr, 4) = "AND "Then
FilterExpr = Left(FilterExpr, Len(FilterExpr) - 4)
End If
Try
Me.SqlDataSource1.FilterExpression = FilterExpr
Me.SqlDataSource1.DataBind()
Me.GridViewSearch.DataBind()
Me.lblMessage.Text =Me.SqlDataSource1.FilterExpression
Catch objExceptionAs SqlException
Dim objErrorAs SqlError
For Each objErrorIn objException.Errors
Response.Write(objError.Message)
Next
End Try
End Sub

MY SPROC

GOALTER PROCEDURE [dbo].[ClientSearch]ASSELECT C.ClientID, C.FirstName, C.LastName, A.Address, C.Comments, C.EMailFROM tblClient CINNERJOIN tblClientAddresses AON C.ClientID = A.ClientID
Remove all the <FilterParameters> and it should work fine.