|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PLEASE EXPLAIN!!!!
When I use the following in my VB code, it works successfully. Set rstUsrauth = olah_cndb.Execute("SELECT * FROM UserAuth WHERE userId = 'EMWATTS'") However, when I use this code, Dim strlogon As String strlogon = txtLogonID.Text 'Set rstUsrauth = olah_cndb.Execute("SELECT * FROM UserAuth WHERE userId = strlogon") I get the following error; runtime error '-2147217904(80040e10)' No value given for one or more required parameters strlogon does have the value that was coded into the text box |
|
#2
|
|||
|
|||
|
Try
Set rstUsrauth = olah_cndb.Execute("SELECT * FROM UserAuth WHERE userId = '" & strlogon & "'") |
|
#3
|
|||
|
|||
|
THANK YOU SO MUCH, DOUG!!!! IT WORKED!!!!!
THIS IS MY FIRST TIME ON THIS SITE, AND I HAVE MADE IT MY HOME PAGE!!! I APPRECIATE YOUR SPEEDY RESPONSE. ![]() |
|
#4
|
|||
|
|||
|
I'm glad it worked
![]() |
|
#5
|
||||
|
||||
|
The thing is that strings are not parsed in VB. So you have to concatonate variables into strings for them to get the correct value you expect them to have. This is what Doug did with &. Your original sql statement would have ended up being:
SELECT * FROM UserAuth WHERE userId = strlogon instead of what was located inside of the textbox. Also, as Doug showed, you have to have character based database fields enclosed in single quotes. For future reference please do not post in all caps, it is considered yelling. Welcome to the Dev Shed community. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > SQL problem with VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|