I was able to get the Insert and Refresh buttons to work with code like this:<br><br>case Button of<br> nbPost: SQLQuery1.Applyupdates;<br> nbRefresh: begin SQLQuery1.Close; SQLQuery1.Open; end;<br>...<br>end;<br><br>However, it doesn't seem to matter what I put in for nbDelete. I always get the error "There are no fields found to generate the where-clause" if I do ApplyUpdates for nbDelete. If I put nothing in there, the field appears to be deleted, but it is still in the table, and comes back to the grid when I press "refresh".<br>
<br><div class="gmail_quote">On Sat, Jun 14, 2008 at 3:22 PM, Howard Lee Harkness <<a href="mailto:howard.lee.harkness@gmail.com">howard.lee.harkness@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ok, I tried calling ApplyUpdates, and I did not detect any difference. Could you perhaps show me in the code below exactly WHERE I need to call ApplyUpdates?<div class="Ih2E3d"><br><br>On Tue, May 27, 2008 at 5:00 AM, Joost van der Sluis <<a href="mailto:joost@cnoc.nl" target="_blank">joost@cnoc.nl</a>> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">That's true. You have to call 'TSQLQuery.ApplyUpdates' Then all changes<br>in the local, in-memory changes-buffer are converted into<br>
update/insert/delete statements and executed on the underlying database.<br><br>For those connections that do support transactions, you also have to do<br>TSQLTransaction.Commit(Retaining).<br></blockquote><br><br></div>
<div><div></div><div class="Wj3C7c">
unit Zipcode;<br>
<br>
{$mode objfpc}{$H+}<br>
<br>
interface<br>
<br>
uses<br>
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,<br>
mysql50conn, sqldb, db, DBGrids, DbCtrls;<br>
<br>
type<br>
{ TForm1 }<br>
TForm1 = class(TForm)<br>
Datasource1: TDatasource;<br>
DBGrid1: TDBGrid;<br>
DBNavigator1: TDBNavigator;<br>
MySQL50Connection1: TMySQL50Connection;<br>
SQLQuery1: TSQLQuery;<br>
SQLTransaction1: TSQLTransaction;<br>
private<br>
{ private declarations }<br>
public<br>
{ public declarations }<br>
end;<br>
<br>
var<br>
Form1: TForm1;<br>
<br>
implementation<br>
<br>
initialization<br>
{$I zipcode.lrs}<br>
end.<br>
<br><br></div></div>-- <br><font color="#888888">Howard Lee Harkness<br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Howard Lee Harkness<br>