我給你個例子:
Private Sub Form_Load()
Dim rs As Recordset
Dim sql As String
Dim conn As New ADODB.Connection
Set rs = New Recordset
conn.ConnectionString = "driver={SQL Server};" & _
"server=電腦名;uid=sa;pwd=;database=mydatabase"conn.Open
sql = "select * from mytable where id=* "
Set rs = conn.Execute(sql)
If rs.RecordCount > 0 Then
    
   rs.MoveFirst
************   
   rs.MoveLast
 End If
End Sub

解决方案 »

  1.   

    Provider=MSDAORA.1;data source=机器名;user ID=TestUser;initial catalog=数据库名;password=Test
      

  2.   

    机器名 是否为远程机器名?我试了,但还是不行,提示:实时错误‘-2147217887'
    多步ole db操作产生错误,请检查每个oledb的状态值,没有工作被完成
      

  3.   

    ASP代码:
    Set OraSession=CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase=OraSession.DbOpenDatabase("infosec.world","gr/123456",0 )
      

  4.   

    ASP代码:
    Set OraSession=CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase=OraSession.DbOpenDatabase("infosec.world","gr/123456",0 )
      

  5.   

    试试:
    ==============================================================
        Dim Cn As ADODB.Connection
        Dim CP As ADODB.Command
        Dim Rs As ADODB.Recordset
        Dim Conn As String
        Dim QSQL As String'Connect to Oracele server begin
    Conn = "DRIVER={ORACLE ODBC DRIVER};" & _
           "SERVER=Servicename;UID=username;PWD=password;" & _
           "DBQ=Servicename;" & _
           "DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;" & _
           "LOB=T;RST=T;FRL=F;MTS=F;CSR=F;PFC=10;TLO=O;"        Set Cn = New ADODB.Connection       With Cn
             .ConnectionString = Conn
             .CursorLocation = adUseClient
             .Open
           End With       If Cn.State = adStateOpen Then
           MsgBox "Connection successful."
           End If'Connect to Oracle server end
    'close connection begin
        Cn.Close
        Set Cn = Nothing
        Set CP = Nothing
    'close connection end
      

  6.   

    你的conn里各参数是什么意思,server和dbq各是什么?ORACLE ODBC DRIVER好象和microsoft odbc driver for oracle是不同的,我的机器只有后者,是否要拿oracle的碟来安装,不是说odbc不支持blob吗?按你今天上午的解法为什么不行呢?
      

  7.   

    SERVER= Your Host Address (Eg:IP Address)DSN is your ODBC DSN; UID is your Windows Network UserID; PWD is an optional Password Protecting the Database; DSQ appears to be the database path and name, minus the last 4 characters(.dbf or .mdb in the examples) - I suspect it may not be needed unless your database name is different from that specified when creating your ODBC DSN. Eg:.Connect = "DSN = FBaccLoc;UID = Admin;PWD = ;DSQ = c:\3gs+3.0\mdb\3gsmain"
      

  8.   

    "按你今天上午的解法为什么不行呢?"
    -- What I said in the Morning ? I remembered I didn't login to CSDN this morning . :)