实时错误'3704'
对象关闭时,操作不被允许
是怎么回事呢?
Public Sub executex()
Dim strsql As String
Dim strcnn As String
Dim cnn1 As ADODB.Connection
Dim rstitles As ADODB.Recordset
strsql = "INSERT INTO authors (au_id, au_lname, au_fname, contract) VALUES ('111-33-5555', 'whii', 'haha', 1)"
strcnn = "Driver={SQL Server};Server=fw;" _
& "Database=pubs;Uid=sa;Pwd=1234;"
Set cnn1 = New ADODB.Connection
cnn1.Open strcnn
Set rstitles = cnn1.Execute(strsql, , adCmdText)
rstitles.Close
cnn1.Close
End Sub
Private Sub Command1_Click()
executex
End Sub
Public Sub executex()
Dim strsql As String
Dim strcnn As String
Dim cnn1 As ADODB.Connection
Dim rstitles As ADODB.Recordset
strsql = "INSERT INTO authors (au_id, au_lname, au_fname, contract) VALUES ('111-33-5555', 'whii', 'haha', 1)"
strcnn = "Driver={SQL Server};Server=fw;" _
& "Database=pubs;Uid=sa;Pwd=1234;"
Set cnn1 = New ADODB.Connection
Set rstitles = New ADODB.Recordset
cnn1.Open strcnn
Set rstitles = cnn1.Execute(strsql, , adCmdText)
rstitles.Close
cnn1.Close
End Sub
Private Sub Command1_Click()
executex
End Sub