Re: ADO\SQLServer\Transactions
From: Viatcheslav V. Vassiliev (support_at_oledbdirect.com)
Date: 06/05/04
- Previous message: Viatcheslav V. Vassiliev: "Re: I miss TBatchMove"
- In reply to: JR: "ADO\SQLServer\Transactions"
- Next in thread: Del Murray: "Re: ADO\SQLServer\Transactions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 5 Jun 2004 20:30:53 +0400
> on Exception do
> begin
> MessageDlg('Exception Message Unable to Update Tables: ' ,
> mtInformation, [mbOK],0);
> raise;
> adoConn.RollbackTrans;
> exit;
> end; //on exception
After raise other statements will not be executed. If you want to display
message, remove line "raise;", if you want to rollback and re-raise
exception, move raise after adoConn.RollbackTrans. Exit is not needed in
both cases.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"JR" <JR65403@att.net> ???????/???????? ? ???????? ?????????:
news:40c1d1f6$1@newsgroups.borland.com...
> I am using Delphi 7, SQLServer 2000, and ADO
>
> I use the ADODatasets in the application to select, insert, update and
> delete records. Is the correct place to setup the
> ADOConnect.BeginTrans, ADOConnect.CommitTrans and ADOConnect.rollback in
> the onclick event of the save button.
>
>
> procedure TfrmDemographicis.btnSaveClick(Sender: TObject);
> var
> Save_Cursor:TCursor;
> begin
>
> Save_Cursor := Screen.Cursor;
> Screen.Cursor := crSQLWait;
> adoConn.BeginTrans;
> try
> adoConn.CommitTrans;
> except
> on Exception do
> begin
> MessageDlg('Exception Message Unable to Update Tables: ' ,
> mtInformation, [mbOK],0);
> raise;
> adoConn.RollbackTrans;
> exit;
> end; //on exception
> end; //try
> Screen.Cursor := Save_Cursor;//
> end;
>
>
> TIA
>
- Previous message: Viatcheslav V. Vassiliev: "Re: I miss TBatchMove"
- In reply to: JR: "ADO\SQLServer\Transactions"
- Next in thread: Del Murray: "Re: ADO\SQLServer\Transactions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]