[SOLVED] how to pass a TBytes value in TSQLQuery as parameter lazarus / 16-Databases ---------------------------------------------------------------------- eara · 2014-04-14 11:15 i want to run the following query Code: [Select]insert into texts(text_guid,text_data) values (:text_guid,:text_data); where   text_guid is declared as VARBINARY(16) in MySQL db 5.5   text_data is declared as TEXT i have created a TGuid, and converted it to a TBytes variable. And now i want now to pass the TBytes variable's value to the TSQLQuery with a ParamByName('text_guid') but ParamByName has no AsBytes property like TField. How should i handle this ? I use VARBINARY(16) for economy and not VARCHAR(38) for guids so .AsString or AsGuid is not a option (i think). ---------------------------------------------------------------------- LacaK · 2014-04-14 12:39 You can set DataType = ftBytes, then create variant array of bytes (VarArrayCreate([0, 15], varByte) and fill it) and pass it as AsVariant. ---------------------------------------------------------------------- eara · 2014-04-14 13:33 thanks, worked.... ---------------------------------------------------------------------- eara · 2014-04-15 22:52 warning for other people that are reading this post and think "oh, i could also use binary fields as primary keys", please note my next problem... http://forum.lazarus.freepascal.org/index.php/topic,24270.0.html which states: yes you can, but don't use DataSet.Locate on this fields  (till next version comes out)