Subject RE: [IBO] How to commit an update from code?
Author Eric Tishler
I finally got it!

Thank you for your suggestions, it got me thinking. Most every thing was already set the way you described it. However it still took a

"ib_connection1.DefaultTransaction.Commit" after the query execute, to make the update stick.

After looking a little harder I found that the IB_Transaction had its Autocommit property set to false. (I do not know how I missed this earlier on) I changed this to true, and it worked! Even without the

"ib_connection1.DefaultTransaction.Commit" after the query execute.


Thank you very much for your help.

Kind regards,
Eric

Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...

-----Original Message-----
From: Don Gollahon [mailto:gollahon@...]
Sent: Friday, April 02, 2004 5:17 PM
To: IBObjects Newsgroup
Subject: Re: [IBO] How to commit an update from code?



""Eric Tishler"" <etishler@...> wrote in message
news:<9211DBA76BE969418E127E8F8C718C5815C5CB@...>...
> 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;

Applyupdates is only needed when CachedUpdates is true. Normally you
don't need it.

>
> CommitAction := caRefresh;
>
> CommitAction := caClose;

CommitAction should be set to the default of caClose on your object. At
least that's what I leave it at. I use an IB_Connection object.
Right-click on it go to the Transaction tab and set the Isolation level
to "Committed (Read Committed)".

If that doesn't help then add a
"ib_connection1.DefaultTransaction.Commit" after the query execute.

> 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@...
>


Don Gollahon
gollahon@...
"The Original GenSoft Prodigal"



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !



_____

Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/

* To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/> Service.


[Non-text portions of this message have been removed]