Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mySQL error: Unterminated string constant

Status
Not open for further replies.

Andrewww

ISP
Aug 27, 2002
6
CA
Hi,

I have an error "Unterminated string constant" in my SQL request.
I guess my syntax is not correct...


mySQL1 = "SELECT * FROM viewTicket where ((TelRes = '" & NoTel & "') OR (TeleTra = '" & NoTel & "')
OR (TeleCel = '" & NoTel & "') OR (NoClient = '" & NoTel & "')) AND ((ServiceName = 'MODEM')
OR (ServiceName = 'UBR') OR (ServiceName LIKE '%BASE%')) "

In other words, I fill a form where the variable NoTel is grabbing what was entered in the form. Then, it search for that value in the database in the fields TelRes, TeleTra, Telecel or NoClient. And, there is a second criteria that search in the field ServiceName for the value MODEM, UBR or *BASE* (whatever is in the field, as long as it find the word BASE).
Can anybody tell me what the exact syntax should be?
Thanks!
 
my guess is that you have either a null value or a misplaced quote in the string...trying response.writing out the query before execution...

then copy that string and run it thru the mysql gui of your choice

Bastien

Cat, the other other white meat
 
I'm not sure if those are hard-returns or not, but if they are , you should change it to this:

mySQL1 = "SELECT * FROM viewTicket where ((TelRes = '" & NoTel & "') OR (TeleTra = '" & NoTel & "') " & _
"OR (TeleCel = '" & NoTel & "') OR (NoClient = '" & NoTel & "')) AND ((ServiceName = 'MODEM') " & _
"OR (ServiceName = 'UBR') OR (ServiceName LIKE '%BASE%')) "

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top