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

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
jeremicm
Senior Boarder
Senior Boarder
Posts: 61
Joined: 18.10.2006, 17:07
Contact:

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

Post 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;
jeremicm
Senior Boarder
Senior Boarder
Posts: 61
Joined: 18.10.2006, 17:07
Contact:

Post by jeremicm »

found it...

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