我想知道这个错误提示是什么意思,我觉得我的代码写得没有问题。Dim rstTmp As New ADODB.Recordset With rstTmp Set .ActiveConnection = cnn .CursorLocation = adUseClient .CursorType = adOpenDynamic .Source = strSQL .Open End WithConnection的连接没有问题,至少没有报错. 郁闷
Dim rstTmp As New ADODB.Recordset With rstTmp Set .ActiveConnection = cnn .CursorLocation = adUseClient .CursorType = adOpenDynamic .Source = strSQL .Open End With这样的写法有问题,主要是出现在.open上。我一般不这样写。我一般这样写 dim rs as new adodb.recordset dim cn as new adodb.connectioncn.open "..." rs.open "select * from table",cn
Dim rstTmp As New ADODB.Recordset With rstTmp Set .ActiveConnection = cnn .CursorLocation = adUseClient .CursorType = adOpenDynamic .Open strSQL End With 或者: Dim rstTmp As New ADODB.Recordset With rstTmp .CursorLocation = adUseClient .Open strSQL,cnn,adOpenDynamic End With
With rstTmp
Set .ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Source = strSQL
.Open
End WithConnection的连接没有问题,至少没有报错.
郁闷
With rstTmp
Set .ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Source = strSQL
.Open
End With这样的写法有问题,主要是出现在.open上。我一般不这样写。我一般这样写
dim rs as new adodb.recordset
dim cn as new adodb.connectioncn.open "..."
rs.open "select * from table",cn
With rstTmp
Set .ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open strSQL
End With
或者:
Dim rstTmp As New ADODB.Recordset
With rstTmp
.CursorLocation = adUseClient
.Open strSQL,cnn,adOpenDynamic
End With
就像楼上的说的
“一个逗号,一个双引号,都有引起---“至少一个参数未指定”错误。”