On 11/3/2015 3:35 PM, Bob M wrote:
I am using the following code:-

rs = s.executeQuery("SELECT Field1, Field2, Field3, Field4 FROM XXXXXX "
     + "WHERE Field1 LIKE String1 AND Field2 LIKE String2 AND Field3 LIKE
String3 AND Field4 LIKE String4 "
     + "GROUP BY Field1, Field2, Field3, Field4");

XXXXXX - table name
Field1  thru Field4 are VARCHAR variables

and am getting the error on String1

If String1 is a literal string constant, for example

        WHERE Field1 like California%

then you want to put your literal string constant in
single quotes, as in:

        WHERE Field1 like 'California%'

or use PreparedStatement substitution, as in:

        WHERE Field1 like ?

        ps.SetString( 1, 'California%' );

bryan

Reply via email to