data reader query

winnie

Member
Joined
Nov 27, 2002
Messages
12
hi. i am using vb.net with sql server as database.
i am using data reader to display some data from my database. here are part of my code.

cd.CommandText = "SELECT *FROM Result WHERE User_ID = name "

the problem is "User_ID" cannot get the value of "name"

any help?? thanks.
 
At the risk of offering an insulting answer... have you tried
cd.CommandText = "SELECT * FROM Result WHERE User_ID=" & name

??? We can start with that and go from there.
 
One more:

Code:
cd.CommandText = "SELECT * FROM Result WHERE User_ID=" & name.Replace("", "") & ""

I may be off on the Replace syntax - Im trying to replace one single quote with two, in case "name" contains a single quote.

-ner
 
thank you everyone. my code can get the value now. i guess dotnet is very picky with the " and sign.
thanks for the help again :p
 

Similar threads

S
Replies
0
Views
57
sva0008
S
D
Replies
0
Views
62
duoshock
D
J
Replies
0
Views
59
Jalil Sear [MCPD SharePoint]
J
J
Replies
0
Views
97
Jackson_1990
J
Back
Top