我有以下缩短的经典ASP代码,使SQL插入调用...
cmd.CommandText = "insert into MyTable values(blah, blah, blah)"
cmd.CommandType = adCmdText
Set rs = cmd.Execute()
Run Code Online (Sandbox Code Playgroud)
使用Execute()返回的记录集如何判断插入是否成功?
检查Err对象
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
Run Code Online (Sandbox Code Playgroud)
还可以在15秒内查看此链接
| 归档时间: |
|
| 查看次数: |
8572 次 |
| 最近记录: |