MySQL: After INSERT my DBGrid is empty :-(
Posted: 14.12.2009, 19:29
Hello,
at the moment I try to realize a MySQL-database in a Delphi program. For this I put the following components onto my form: ZConnection (mySQL-configuration), ZQuery, DataSource and DBGrid (and some buttons).
With the following code I connect with the database:
That works just fine. After that I wanted to create a new line (record?) in the table:
The one thing that works is: the new line is inserted correctly. But after the click onto the button the DBGrid is empty.
Could you please help me out here?
Thanks in forward.
Bye The_Unknown (sorry for the bad English )
at the moment I try to realize a MySQL-database in a Delphi program. For this I put the following components onto my form: ZConnection (mySQL-configuration), ZQuery, DataSource and DBGrid (and some buttons).
With the following code I connect with the database:
Code: Select all
ZConnection1.Connected := True;
ZQuery1.SQL.Text := 'SELECT * FROM customers;';
ZQuery1.Active := True;
Code: Select all
ZQuery1.SQL.Text :=
'INSERT INTO `customers` (`First`,`Last`,`eMail`,`Street`,`ZIP`,`PCity`) VALUES'+
'(''1'', ''2'', ''3'', ''4'', ''5'', ''6'');';
ZQuery1.ExecSQL;
Could you please help me out here?
Thanks in forward.
Bye The_Unknown (sorry for the bad English )