"rolling back" on AddNew 
Author Message
 "rolling back" on AddNew

I am using a Shape recordset opened as follows:

rsMain.Open cmd, , adOpenStatic, adLockBatchOptimistic, adCmdText

The database is MS-SQL. I am adding a child record as follows:

rsChild.addNew Array("fld1", "fld2", "fld3", "fld4"), _
            Array(val1, val2, val3, val4)

There is an on insert trigger in the underlying child table. Under some
conditions, the trigger generates an error message. I wish to "rollback" the
addNew when such a condition occurs. I am using the following error:

  mResult = cn.Errors(0).NativeError & " : " & cn.Errors(0).Description
  mResult = MsgBox(mResult, vbExclamation, "Insert Error")

The new line indeed disappears from the DataGrid attached to rsChild, but
the record does not disappear from the child table.

Could someone please help me resolving this problem.


Dan Kimhi

Fri, 24 Jun 2005 04:47:35 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Disabling "BACK"/"FORWARD" buttons

2. Disabling "BACK"/"FORWARD" buttons

3. ADO "roll-your-own" vs dataenvironment

4. ADO "AddNew" Performance Issue

5. AddNew "Not Supported by Provider"?

6. Problem whit "Addnew" in Microsoft Interdev

7. AddNew and "Edit" with ADO

8. AddNew and "Edit" with ADO

9. Remove Links From "Back" Navigation

10. How do I Prevent a "Back"

11. Disable "Back" Button

12. How to disable the "Back" button


Powered by phpBB® Forum Software