mysql_query syntax error while sql string have length more than 256 chars lazarus / 16-Databases ---------------------------------------------------------------------- andipurwito · 2010-08-31 07:59 I have an error like this : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bla..bla..' at line 1. while call my function below: function InsertSQL(strSQL: AnsiString; CS: TCriticalSection; var ErrMsg: AnsiString): boolean; var   td: TDBCfg;   SockMySQL: PMySQL;   SQL: PChar; begin   CS.Acquire;   Result := False;   try     {alokasi memory query}     SQL := StrAlloc(Length(strSQL)+1);     {Get database settings}     td := TDbCfg.Create;     td := GetDbConfig;     {Make MySQL Connection}     if CreateDbConn(td, SockMySQL, ErrMsg) then     begin       StrPCopy(SQL, strSQL);       if mysql_query(SockMySQL, SQL) <> 0 then         ErrMsg := 'InsertSQL->'+PCharToStr(mysql_error(SockMySQL))       else         Result := True;     end;   except on E:Exception do     ErrMsg := 'InsertSQL->'+E.Message;   end;   td.Free;   StrDispose(SQL);   mysql_close(SockMySQL);   CS.Release; end; The function always got this error while length of my strSQL contains more than 256 chars. Anyone can help me to fix this function? Thanks and best regard! GolekUpo.Org ---------------------------------------------------------------------- Leledumbo · 2010-09-01 09:55 See my answer in FPC forum