PDA

Click to See Complete Forum and Search --> : SQL


zambian
Mar 19th, 2000, 10:37 PM
Hi Guys,

I need an explanation...
When I run this query:

"select name from tbl where ID = 2"

it gives me an output.


Now, when I do this:

Dim x as integer
x=2
"select name from tbl where ID=x"

I get an error saying "Too few parameters. Required 1"

Any help will be appreciated

JHausmann
Mar 19th, 2000, 10:44 PM
"select name from tbl where ID=x" isn't telling vb to use the variable x. You need to do it this way to make that happen:

"select name from tbl where ID=" & x

Elias
Mar 20th, 2000, 05:28 AM
if your variable 'x' is a string then it needs to be:
"select name from tbl where ID='" & x & "'"