Avatar of jjc9809
jjc9809
 asked on

I need help with this SQl Statement

Hi Everyone,

I have this SQL Statement that isgiving me a ssyntax error.  What is wrong with the coding?
I have quotes wroing somehow.

This statement should pull a record by a Driver License Number entered in the textbox called strlicense when an event button is selected.

The statement:

Dim strQuery As String = "Select * FROM PersonOfInterest WHERE PK_DriverLicenseID_vch Like '"& strLicense & %'"
Microsoft SQL Server

Avatar of undefined
Last Comment
Habib Pourfard

8/22/2022 - Mon
SOLUTION
Paul Jackson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Habib Pourfard

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jjc9809

ASKER
Hey guys see the error I am getting.
Error.jpg
Habib Pourfard

if strLicense is the name of a TextBox then replace it with: strLicense.Text

Dim strQuery As String =  "Select * FROM PersonOfInterest WHERE PK_DriverLicenseID_vch Like '" & strLicense.Text & "%'"

Open in new window

Your help has saved me hundreds of hours of internet surfing.
fblack61