J
JE
I'm trying to insert data into a SQL Server 2000 table using the following
code:
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data
Source=SQL01"
cn.Open
Dim rs As New ADODB.Recordset
With rs
.CursorLocation = adUseServer
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Open ("SELECT * FROM Claims")
End With
rs.AddNew
The code fails on rs.AddNew with the message "The connection cannot be used
to perform this operation. It is either closed or invalid in this context"
What am I doing wrong?
Thanks!
code:
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data
Source=SQL01"
cn.Open
Dim rs As New ADODB.Recordset
With rs
.CursorLocation = adUseServer
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Open ("SELECT * FROM Claims")
End With
rs.AddNew
The code fails on rs.AddNew with the message "The connection cannot be used
to perform this operation. It is either closed or invalid in this context"
What am I doing wrong?
Thanks!