I have the following shortened classic ASP code that makes a SQL insert call...
cmd.CommandText = "insert into MyTable values(blah, blah, blah)"
cmd.CommandType = adCmdText
Set rs = cmd.Execute()
Using the recordset that Execute() returns how can I tell whether the insertion was successful or not?
Check the Err object
cmd.CommandText = "insert into MyTable values(blah, blah, blah)"
cmd.CommandType = adCmdText
On Error Resume Next
Set rs = cmd.Execute()
If Err.number<>0 or objConnection.Errors.Count <> 0 Then
'Do something to handle the error
End If
On Error Goto 0
Also have a look at this link over at 15Seconds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With