Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

VInterDev Select Query w/Criteria

I'm issuing a select query from a form handler to look up user id's and password values.  If I leave off the criteria, the query works fine, but for some reason, the where statement causes the error.

I'm using the DCC/DTC but I get the same error when I create the query manually.

"SELECT passwords.* FROM passwords WHERE (UserID = " & user & ")"

Error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.

This is a simple problem but it's driving me crazy.  I have several other queries in my application that are structured almost exactly like this one and they work.

Thanks in advance...
0
jlow
Asked:
jlow
  • 2
1 Solution
 
JamesNCommented:
What type is UserID in the database?
0
 
jlowAuthor Commented:
The UserID field type is 'text'.
0
 
JamesNCommented:
Try:

"SELECT passwords.* FROM passwords WHERE (UserID =' " & user & "')"

i.e. add single quotes around the parameter in the SQL string.

Hope this helps,
    James
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now