Re: ADO and DELETE Statement
- From: "Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Jun 2006 19:08:28 -0500
Skeeve wrote:
I have a little issue with ADO 2.7. I am using a string like 'DELETE
FROM tablename WHERE field = condition'.
Now, this works it seems in 99% of the time. But occasionally, the
record is not deleted which results in the record being processed
twice. I am using this for a receiving interface with a third part
software. It is basically reading a record, posting a purchase order
and if the order posted successfully, I delete the record. So if it is
not deleted (for whatever reason), the purchase receipt is posted
twice.
I was wondering if there is any way with ADO to check if the operation
was successfull or not. Obviously, there is no recordset returned for
a DELETE operation.
Thanks for any help!
Hi,
Can you use transactions? The ADO connection object has BeginTrans,
CommitTrans, and RollbackTrans methods. Also, if an error is raised when the
delete fails, you should be able to trap that. In brief:
read record
BeginTrans
post purchase order
delete record
CommitTrans
If the CommitTrans method is never invoked because the delete failed, the
purchase order is never posted. Transaction rollbacks apply to INSERT,
UPDATE, and DELETE statements, but not SELECT, CREATE, ALTER, or DROP.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
.
- Follow-Ups:
- Re: ADO and DELETE Statement
- From: Skeeve
- Re: ADO and DELETE Statement
- References:
- ADO and DELETE Statement
- From: Skeeve
- ADO and DELETE Statement
- Prev by Date: SQL Server Timeout over the Network vs. Local
- Next by Date: Re: SQL Server Timeout over the Network vs. Local
- Previous by thread: ADO and DELETE Statement
- Next by thread: Re: ADO and DELETE Statement
- Index(es):