I am trying to perform a query on an Access database using Visual Web Developer based on a session variable. Here is the whole tag:
<asp:AccessData Source ID="AccessDataS ource1" runat="server" DataFile="~/Residents.mdb"
SelectCommand=" SELECT [last], [first], [unit], [urb] FROM [Residents] WHERE ([last] LIKE '%' + ? + '%')">
Now I only want the results to start with lets say 'S' for Smith or Smitty. I understand that there should be no wildcard operator before the session variable ? above. But if I change the code it results nothing as the search, I have tried these variations with no success:
WHERE ([last] LIKE '' + ? + '%')">
WHERE ([last] LIKE ? + '%')">
WHERE ([last] LIKE '?%')">
Visual Web Developer automatically puts the ? in place of the session variable, which BTW is called Session("NAME")
Can anyone please help with how to format the code so it would work? Thanks!
<asp:AccessData Source ID="AccessDataS ource1" runat="server" DataFile="~/Residents.mdb"
SelectCommand=" SELECT [last], [first], [unit], [urb] FROM [Residents] WHERE ([last] LIKE '%' + ? + '%')">
Now I only want the results to start with lets say 'S' for Smith or Smitty. I understand that there should be no wildcard operator before the session variable ? above. But if I change the code it results nothing as the search, I have tried these variations with no success:
WHERE ([last] LIKE '' + ? + '%')">
WHERE ([last] LIKE ? + '%')">
WHERE ([last] LIKE '?%')">
Visual Web Developer automatically puts the ? in place of the session variable, which BTW is called Session("NAME")
Can anyone please help with how to format the code so it would work? Thanks!
Comment