DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

escape syntax for quotes

Solved!
Go to solution

Hi,

I'm trying to query some data in a diadem script.  The syntax which works fine in the MySQL query browser is:

 

SELECT * FROM uut_battery_task_summary WHERE uut_result = "{19dc2179-c4e8-436f-a3b1-e91651b8924f}";

 

 

but when structuring the query in a vb script in Diadem I am getting an "invalid character" at the "{" character with the line:

 

Call SQL_ExecDirect("SELECT * FROM uut_battery_task_summary WHERE uut_result = "{19dc2179-c4e8-436f-a3b1-e91651b8924f}"")

 

So I tried escaping the quotes, with:

 

Call SQL_ExecDirect("SELECT * FROM uut_battery_task_summary WHERE uut_result = \"{19dc2179-c4e8-436f-a3b1-e91651b8924f}\"")

 

and I am still getting the error with the same character.  This is probably a newbie error, just starting out with VB.  Can someone point out what is wrong?  Can I literally enclose {19dc2179-c4e8-436f-a3b1-e91651b8924f} without it complaining somehow?  I also tried LIKE "19dc2179-c4e8-436f-a3b1-e91651b8924f", and also with escaped \" quotes, but still no luck.

 

Thanks for any help

David J.

 

0 Kudos
Message 1 of 3
(4,534 Views)
Solution
Accepted by topic author david_jenkinson

Hello David!

 

In VBS a double-quote is escaped with a double-double-quote. In your examplel

 

  Call SQL_ExecDirect("SELECT * FROM uut_battery_task_summary WHERE uut_result = ""{19dc2179-c4e8-436f-a3b1-e91651b8924f}""")

 

should work.

 

Matthias

Message Edited by Twigeater on 11-06-2009 07:55 AM
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 3
(4,527 Views)

Ah thanks.  I actually solved this also by using a single quote, strangely enough.

 

Regards,

David J.

0 Kudos
Message 3 of 3
(4,466 Views)