M
Maciek Pawlowski
I have designed an sql query to retrieve data from a table based on an
integer field which happens to be the primary key for the table.
The table looks like this:
tbl_players
Cust Id (int) <---Primary key
fName (varchar 50)
lName (varchar 50)
Now, I have the following SQL query to return the fName and lName according
to the CustId:
SELECT fName, lName
FROM tbl_players
WHERE custId LIKE @custId
The database is an SQL Server database.
Now, I want to be able to select all players from the table by passing in
the % wildcard character to the @custId parameter from my asp.net app using
C# codebehind. However, when I set the value of the @custId parameter to %,
nothing gets selected. If I pass in a valid custId (ie one that exists in
the database) it returns the appropriate data.
What am I doing wrong? I use the following line to assign the % character
to the @custId parameter:
sqlSelectCommand.Parameters["@custId].Value = '%';
I have also tried:
sqlSelectCommand.Parameters["@custId].Value = "%";
Thanks in advance,
maciek
integer field which happens to be the primary key for the table.
The table looks like this:
tbl_players
Cust Id (int) <---Primary key
fName (varchar 50)
lName (varchar 50)
Now, I have the following SQL query to return the fName and lName according
to the CustId:
SELECT fName, lName
FROM tbl_players
WHERE custId LIKE @custId
The database is an SQL Server database.
Now, I want to be able to select all players from the table by passing in
the % wildcard character to the @custId parameter from my asp.net app using
C# codebehind. However, when I set the value of the @custId parameter to %,
nothing gets selected. If I pass in a valid custId (ie one that exists in
the database) it returns the appropriate data.
What am I doing wrong? I use the following line to assign the % character
to the @custId parameter:
sqlSelectCommand.Parameters["@custId].Value = '%';
I have also tried:
sqlSelectCommand.Parameters["@custId].Value = "%";
Thanks in advance,
maciek