Page 1 of 1

Query string too long

Posted: 08.08.2011, 16:41
by christensen
Hi,

I wan to make a select query with more than 255 characters but i get error.
Error: Constant strings can't be longer than 255 chars
How can solve this?

I'm running Windows 7 Ultimate 32-bit, Lazarus 0.9.30, FPC 2.4.4, Zeoslib 6.6.6, Firebird 2.1.3.

Here is a part from my code:

Code: Select all

frmsetting.qryList.Close;
frmsetting.qryList.SQL.Clear;
frmsetting.qryList.SQL.Add('select n_client as "Client Name", phone_no as "Phone No.", address as "Address", ...... , from tb_client where ID_CLIENT='''+select_idM+''' ');
frmsetting.qryList.Open;
Thanks

Posted: 08.08.2011, 20:44
by mrLion
christensen, use multistring SQL.

.....SQL.Add("..... string 1.......");
.....SQL.Add("..... string 2.......");

.......

Posted: 09.08.2011, 08:50
by jeremicm
Also instead of

Code: Select all

where ID_CLIENT='''+select_idM+''' 
use

Code: Select all

where ID_CLIENT= :ClientID
frmsetting.qryList.ParamByName('ClientID').Value := select_idM;

Posted: 09.08.2011, 21:39
by christensen
thanks to both of you