dim rs as new adodb.recordset
dim cn as new adodb.connectioncn.open "..."
rs.open "select * from table",cn

解决方案 »

  1.   

    我想知道这个错误提示是什么意思,我觉得我的代码写得没有问题。Dim rstTmp As New ADODB.Recordset
    With rstTmp
            Set .ActiveConnection = cnn
            .CursorLocation = adUseClient
            .CursorType = adOpenDynamic
            .Source = strSQL
            .Open 
       End WithConnection的连接没有问题,至少没有报错.
    郁闷
      

  2.   

    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
      

  3.   

    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
      

  4.   

    看看你的库结构有没有改变,如果你加了新字段,在你的数据环境中没有更新(如果你使用了数据环境),就会出现这个错误。检查一下你的sql语句,是否有空格没空,或者等号等符号是双字节的?呵呵,这些都是可能,你看看吧
      

  5.   

    这种情况我经常遇到,百分之八十以上的可能就是sql语句写错了。
    就像楼上的说的
    “一个逗号,一个双引号,都有引起---“至少一个参数未指定”错误。”