LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Request SQL contains keyword "LIKE"

Solved!
Go to solution

Hi,

 

I want to select 'Id' from 'table' where chaine begins with 'BR' the request is like this : SELECT Id FROM table  WHERE chaine  LIKE 'BR%', it works when i run it in MS Access but when i include it in Labwindows CVI it generate an error ( unknown specifier).

 

I'm searching for the equivalent of the caracter % .

 

Note:

Hardware Environment: PC DELL  intel(R) Core(TM) 2DUO CPU

Software Environment : Labwindows CVI  2010

 

 

 

0 Kudos
Message 1 of 3
(3,738 Views)

Hi FENM,

 

I'm not sure that I completely understand what is happening - would you mind posting a screenshot or sample of the code that isn't working?

 

--G-IV

0 Kudos
Message 2 of 3
(3,677 Views)
Solution
Accepted by FENM

Hello,

 

If you use sprintf to format the request, % is the format specifier ==> you must use %% in the format string to escape the format specifier (%) 

 

sprintf (request,  "SELECT Id FROM table  WHERE chaine  LIKE 'BR%%'");

 

with a string parameter:

sprintf (request,  "SELECT Id FROM table  WHERE chaine  LIKE '%s%%'", "BR");

Message 3 of 3
(3,654 Views)