Menu

Prb with INSERT command

Help
2004-02-09
2013-04-02
  • Nobody/Anonymous

    I'm trying to execute an INSERT command with the function "query", but it doesn't work, and I haven't found any examples for something like that. Is directSQL not meant to execute INSERTs?

     
    • Jeremy Darling

      Jeremy Darling - 2004-02-09

      W/O seeing your code I"m going to guess that your calling Query incorrectly.  The function header is:

      function query(const aquery: string; StoreResult: boolean; var ExecutedOk:
            boolean): TMysqlResult;

      Notice the StoreResult?  Make sure that you are setting this to false as a call to: Insert, Delete, and at times Update does not return a result set.  Also make sure and  pass in a var for executedok to test if your insert was accepted by the server.

      Jeremy

       
    • Nobody/Anonymous

      qry:='UPDATE `sns` SET prg = `'+edit1.Text+'`, user = `'+edit2.Text+'`, sn = `'+edit3.Text+'` WHERE id = `'+edit4.Text+'`;';
      MySQL.Query(qry,false,executed);

      Why is this not working?

      This works...
      Result:=MySQL.Query('Select * FROM `sns` order by `prg`',True,executed);
      stringgrid1.RowCount:=Result.RowsCount;
      stringgrid1.Cells[0,n]:=Result.FieldValue(1);
      stringgrid1.Cells[1,n]:=Result.FieldValue(2);
      stringgrid1.Cells[2,n]:=Result.FieldValue(3);
      stringgrid1.Cells[3,n]:=Result.FieldValue(0);

       
      • Nobody/Anonymous

        Problem solved, replaced ` with '' and it works now.

         
    • Nobody/Anonymous

      Nevermind, figured out problem.  replaced ` with '' and it works now.

       
    • Nobody/Anonymous

      Having problem while trying to insert strings which contain special chars as (äöüõ etc), ExecutedOK returns false.

      MYSQL has charset unicode.

      Any ideas?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.