在我的一个函数里:
Dim oRS As ADODB.Recordset
Dim ssql, srCode, srName As String
ssql = "select right_code,right_name from system_authorization " Set oRS = goAdocn.Execute(ssql) '出错了
error:
object variable or with block variable not set 可是我曾经在login in 的ok按扭中用了这句话没错的呀?请各位xdjm帮忙呀.

解决方案 »

  1.   

    Dim oRS As ADODB.Recordset
    Dim ssql, srCode, srName As String
    ssql = "select right_code,right_name from system_authorization "
    Set oRS = new ADODB.Recordset
     Set oRS = goAdocn.Execute(ssql) '出错了
      

  2.   

    Dim oRS As New ADODB.Recordset
    Dim ssql as string, srCode as string, srName As Stringssql = "select right_code,right_name from system_authorization "Set oRS = goAdocn.Execute(ssql) 试试,没遇到过。
      

  3.   

    1 可能是goAdocn 没有set 注意变量的有效范围。
    2 是不是上一次使用oRS之后没有close掉。
      

  4.   

    dim oRS as new Adodb.recordset
    Set oRS =  goAdocn.Execute(ssql)
      

  5.   

    New 一下, 给Object分配一下空间.
      

  6.   

    是不是你的Connection 被關閉了﹖