|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Where Statement
I am using VB6 with Access 97, I am trying to query a database called customer. using a SQL string.
This is the Syntax that works: sSQL = "SELECT * FROM Customer WHERE Customer.Name = 'susan' " If I use a string variable to store the customer name that I am looking for it does not work name = "susan" sSQL = "SELECT * FROM Customer WHERE Customer.Name = " &name I am getting this error message Run-time error-'214721709(80040e10)': [Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters Expected 1. I have researched this error message and it means that the field in the Customer table that I am reference is incorrect. I have verified this and it is correct. If I used an integer variable instead of a string variable it works. i = 7 where is an interger sSQL = "SELECT * FROM Customer WHERE Customer.Name = " & STR(i) Can some one please help Thanks In advance Valerie |
|
#2
|
||||
|
||||
|
Change
sSQL = "SELECT * FROM Customer WHERE Customer.Name = " &name TO sSQL = "SELECT * FROM Customer WHERE Customer.Name = '" & name & "'" Notice the single quotes when you give a string to a query you have to put single quotes around it but intergers you do not. |
|
#3
|
|||
|
|||
|
Thanks for your response it worked
Valerie |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Where Statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|