Wow, thanks for your thorough explanation.
All understood.
I will try that out.
Umm, I have another quick question here:-
I have been using the sqlDataSource control for about a week now but just recently came accross a situation whereby I need to build dynamic sql.
Initially, I opt to do things in the vb side where I'd do
sSQL = "select * from tableA where 1=1 "
if txtName.text <> ""
sSQL += "and vaNAME like '%" + txtName.text + "%' "
end if
if dtDate.text <> ""
sSQL += "and dtCREATED > '" + dtDate.text + "' "
end if
However, one problem encountered is, when using manual data binding, extra codes are needed to handle pageIndexChanged exception
So, I changed the strategy to go into using an sqlDataSource object. My code is as per below:-
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ... SelectCommand="select convert(datetime, dtCREATED, 103), * from tableA where vaNAME like '%@vaNAME%' and dtCREATED > @dtDATE ORDER BY dtCREATED">
<asp:ControlParameter Name="vaNAME" ControlID="txtName" PropertyName="text" DefaultValue="" Type="string" />
<asp:ControlParameter Name="dtDATE" ControlID="txtDate" propertyname="value" DefaultValue="" Type="string" />
</asp:SqlDataSource>
My question is, Is the sql part in the selectCommand okay (especially the part highlighted in red) ?
I have tried all sorts of ways but to no avail.
Results aren't coming out.
Sorry for the long-winded post.