prm
February 8th, 2005, 04:39 PM
Hi,
I have a 2 drop down lists. The first list contains alphabets from A-Z. When the user selects a an alphabet in the first list, the second list gets populated (from the database) with all customer names beginning with that alphabet.
But I am facing problem with the SQL command to get values from the
Database.I am using the sqlCommand text as :
SELECT CustName FROM Table WHERE (CustName LIKE @x)
Here @x (the parameter) is the alphabet which the user selects from the
first dropdown list. Now, I want all CustNames which start with the letter
chosen by the user.
I tried the command with a % sign after the parameter like
SELECT CustName FROM Table WHERE (CustName LIKE @x%)
but it said Syntax is wrong. I even tried '@x*' and '@x%' and even @x %25 , but nothing
seems to work.
What is the right syntax for this?
Please help.
Thanks
I have a 2 drop down lists. The first list contains alphabets from A-Z. When the user selects a an alphabet in the first list, the second list gets populated (from the database) with all customer names beginning with that alphabet.
But I am facing problem with the SQL command to get values from the
Database.I am using the sqlCommand text as :
SELECT CustName FROM Table WHERE (CustName LIKE @x)
Here @x (the parameter) is the alphabet which the user selects from the
first dropdown list. Now, I want all CustNames which start with the letter
chosen by the user.
I tried the command with a % sign after the parameter like
SELECT CustName FROM Table WHERE (CustName LIKE @x%)
but it said Syntax is wrong. I even tried '@x*' and '@x%' and even @x %25 , but nothing
seems to work.
What is the right syntax for this?
Please help.
Thanks