Page 1 of 1

What's wrong with my code? SQL syntax error????

Posted: 17.08.2010, 11:52
by jeremicm
hello, can some one help me with this?

when i execute this code i get "SQL syntax error near ')'" for some reason...

when i change ParamByName.AsWideString to ParamByName.Value, my comand execute fine without errors....

table in my database is in utf8 with one text and one varchar field...


thanks in advance..

edit: i use rad studio 2010 and mysql 5.1 on win7 pro...

Code: Select all

  with TZQuery.Create(Self) do
  try
    Connection := ZConnection1;
    Close;
    SQL.Clear;

    SQL.Add('INSERT INTO cyrtbl');
    SQL.Add('(c1, c2)');
    SQL.Add('VALUES (:c1, :c2)');
    ParamByName('c1').AsWideString := LabeledEDit1.Text;
    ParamByName('c2').AsWideString := RichEdit1.Text;
    ExecSQL;
  finally
    Free;
  end;

Posted: 17.08.2010, 12:15
by jeremicm
found it...

need to use ParamByName.AsAnsiString instead of ParamByName.AsWideString...