Click here to Skip to main content
15,913,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im trying to make a simpale Select query but I'm heaving some dificulties.

my Sql command is:

"SELECT IDNum, Street, HouseNum FROM(ProgDB) WHERE (Street = N'" & street & "')"


it dose'nt work even if i change the code to:

"SELECT IDNum, Street, HouseNum FROM(ProgDB) WHERE (Street = N'@street')"


could some one please helo me spot the problem?

Thank you in advance, Tsahi.
Posted

-- in a stored procedure
select IDNum, Street, HouseNum from [Table] WHEE Street = @street 

'in VB
"select IDNum, Street, HouseNum from [Table] WHEE Street = '" & street & "'"

//in C#
"select IDNum, Street, HouseNum from [Table] WHEE Street = '" + street + "'";
 
Share this answer
 
v2
Comments
tsahi-al 5-Oct-11 8:17am    
it dosen't work

BTW im using VB with it
Try
SELECT IDNum, Street, HouseNum FROM(ProgDB) WHERE (Street = 'N" & street & "') 

Move the apostrophe before N.
 
Share this answer
 
v2
Comments
tsahi-al 5-Oct-11 8:13am    
it dosen't work eithere

BTW im using VB with it
just remove the parentheses around the table name

SQL
"SELECT IDNum, Street, HouseNum FROM ProgDB WHERE (Street = N'" & street & "')"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900