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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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
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);
Problem solved, replaced ` with '' and it works now.
Nevermind, figured out problem. replaced ` with '' and it works now.
Having problem while trying to insert strings which contain special chars as (äöüõ etc), ExecutedOK returns false.
MYSQL has charset unicode.
Any ideas?