Subject | How to commit an update from code? |
---|---|
Author | Eric Tishler |
Post date | 2004-04-02T21:26:02Z |
I am running an update query in code. I construct the query manually and then run it using ExecSQL. But the update never seems to take place
This is my code (where qryTemp is a TIB_Query)
With DataAccessMod.qryTemp do
Begin
Active := False;
SQL.Clear;
// construct the query
SQL.Add('UPDATE "UserAccounts" SET ');
SQL.Add('"Credits" = ' + IntToStr(iAmount) + ' ');
SQL.Add('WHERE "AccountID" = ' + IntToStr(iUserID));
// run the query
ExecSQL;
// After doing this I have tried each of the following: (one at a time)
ApplyUpdates;
CommitAction := caRefresh;
CommitAction := caClose;
End;
But there are no changes to the Credits field in the UserAccounts table.
Can somebody help me?
Thank you,
Eric
Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...
This is my code (where qryTemp is a TIB_Query)
With DataAccessMod.qryTemp do
Begin
Active := False;
SQL.Clear;
// construct the query
SQL.Add('UPDATE "UserAccounts" SET ');
SQL.Add('"Credits" = ' + IntToStr(iAmount) + ' ');
SQL.Add('WHERE "AccountID" = ' + IntToStr(iUserID));
// run the query
ExecSQL;
// After doing this I have tried each of the following: (one at a time)
ApplyUpdates;
CommitAction := caRefresh;
CommitAction := caClose;
End;
But there are no changes to the Credits field in the UserAccounts table.
Can somebody help me?
Thank you,
Eric
Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...