vb+sql 实时错误'3705',对象打开时,不允许操作
PrivateSubCommand1_Click()DimcnnAsNewADODB.ConnectionDimrsAsNewADODB.Recordsetcnn.Ope...
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=weight;Data Source=TECH000"
rs.Open "SELECT * FROM data", cnn, adOpenDynamic, adLockOptimistic
rs.CursorLocation = adUseClient
Set DataGrid1.DataSource = rs
End Sub
调试时黄条会出现在rs.CursorLocation = adUseClient
高手指点下哪错了? 展开
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=weight;Data Source=TECH000"
rs.Open "SELECT * FROM data", cnn, adOpenDynamic, adLockOptimistic
rs.CursorLocation = adUseClient
Set DataGrid1.DataSource = rs
End Sub
调试时黄条会出现在rs.CursorLocation = adUseClient
高手指点下哪错了? 展开
1个回答
2010-12-11
展开全部
rs.Open "SELECT * FROM data", cnn, adOpenDynamic, adLockOptimistic
rs.CursorLocation = adUseClient
这2句对调下位置
实时错误'3705',对象打开时,不允许操作 这句已经提示很明显了 你rs对象是打开了
rs.CursorLocation = adUseClient
这2句对调下位置
实时错误'3705',对象打开时,不允许操作 这句已经提示很明显了 你rs对象是打开了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询