Results 1 to 3 of 3

Thread: SQL

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    18
    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

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    "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

  3. #3
    Member
    Join Date
    Oct 1999
    Location
    Snellville, GA, USA
    Posts
    38
    if your variable 'x' is a string then it needs to be:
    "select name from tbl where ID='" & x & "'"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width