Page 1 of 1

Problem with string parameter of TZQuery

Posted: 06.03.2009, 02:15
by CoMPi
I have a problem with ZeosLib 7.0 + MySQL + Delphi 2009 Pro.
I noticed that assigning a unicode value to a string parameter of TZQuery is not correct. To be more precise I give an example:

// query with parameter
qry.SQL.Text := 'INSERT INTO MyTable (StringField) VALUES (:AStringParam)';
qry.ParamByName('AStringParam').AsString := 'ąćń';
qry.ExecSQL;

After that in the table I have some strange characters. But if I execute something like this:

// query without parameter
qry.SQL.Text := 'INSERT INTO MyTable(StringField) VALUES (''ąćń'')';
qry.ExecSQL;

the content of the table is correct. What is wrong with my code?

Thank you in advance