'数据库连接(使用“system”用户连接数据库)
With ADODB_Source
        If .State = 1 Then
            .Close
        End If
        .ConnectionTimeout = 60
        .Provider = "MSDAORA.1"
        .ConnectionString = "Data Source=GGF;Password=manager;User ID=system"
        .CursorLocation = adUseClient
        .Open
    End With'执行查询
strSQL = "select distinct lngOperatorID,stroperatorcode,stroperatorname from System.MyOperatorAuth,GADATA0001.Operator t where MyOperatorAuth.Lngerpoperaterid = t.Lngoperatorid(+)"
        Set rsTemp = ADODB_Source.Execute(strSQL)
        With rsTemp
            If .RecordCount > 0 Then
                .MoveFirst
                ……
                ……
            End If
        End With
        ……这样查出来的记录数等于0,而把同样的SQL语句 select distinct lngOperatorID,stroperatorcode,stroperatorname from System.MyOperatorAuth,GADATA0001.Operator t where MyOperatorAuth.Lngerpoperaterid = t.Lngoperatorid(+) 复制到PL/SQL Developer中(以System登录)执行,却有记录。为什么?

解决方案 »

  1.   

    这一句出现的问题;:
    .ConnectionString = "Data Source=GGF;Password=manager;User ID=system"
    把.ConnectionString = ""写成下面的形式就ok了;:
    .ConnectionString = "Provider=XXX;Data Source=XXX;Persist Security Info=False;.........."
      

  2.   

    gjianpro(#ifndef DEBUG) :
    我试了一下,没有用啊。
      

  3.   

    如果.RecordCount = 0,很可能是SQL语句的问题;
    如果.RecordCount = -1,很可能是记录集锁定类型或游标类型的问题。
    所以,请楼主先确认一下.RecordCount到底是多少?
      

  4.   

    VB里跟踪下来.RecordCount = 0,但是在PL/SQL Developer中同样的SQL语句,查出1条记录(事实就是1条记录)。
    要是说SQL语句有问题,为什么在PL/SQL Developer中能查出数据?
      

  5.   

    以上是我的个人看法。
    我对Oracle不了解,没办法帮你了啊!
      

  6.   

    知道了。我把ADO版本从2.5升到2.7就OK了。
    谢谢各位。