我这样写的,程序在我机器上能运行,但是源文件到别人机器上不能运行Public Function getstrs(Optional strQue As String) As Object
    Dim cnst As ADODB.Connection
    Dim Conn As String
    Conn = "UID=tll;PWD=tll;DRIVER={Microsoft ODBC for Oracle};" _
         & "SERVER=tll;"
    Set cnst = New ADODB.Connection    With cnst
      .ConnectionString = Conn
      .CursorLocation = adUseClient
      .Open
    End With
    Dim rs As New ADODB.Recordset
    If Len(strQue) > 0 Then
        Set rs = New ADODB.Recordset
    Else
        Exit Function
    End If
    rs.CursorLocation = adUseClient
    rs.Open strQue, cnst, adOpenDynamic, adLockOptimistic
    Set getstrs = rs
  
    Exit Function
End Function

解决方案 »

  1.   

    报错说  MS driver odbc for oracle    有错
      

  2.   

    连接字符串改下这样呢?
    "Provider=MSDAORA.1;Password=tll;User ID=tll;Data Source=tll;Persist Security Info=True"
      

  3.   

    ODBC配了没!控制面板-管理工具-ODBC数据源
      

  4.   

    建议用阿龙的连接,你可以通过oracle客户端程序net8来配置.不须配odbc
    如果你用odbc的话,在别人电脑上必须配相同名字的ODBC
    在你的程序里须在别人电脑配一个名为tll的odbc 名字!