ADO Connection Gets Dropped - Help Needed

ADO Connection Gets Dropped - Help Needed

Post by bwask.. » Tue, 17 Apr 2001 03:35:51



I use the following code to make an ADO connection to an Oracle
database. The connection is successful, but the query doesn't run. Any
help would be greatly appreciated.

Private Sub Form_Load()
' declaring the ADO connection
Dim conn As ADODB.Connection
'Dim cmd As ADODB.Command
Dim recset As New ADODB.Recordset
Set conn = New ADODB.Connection
'Set cmd = New ADODB.Command
' connection string needed to get to Oracle
conn.ConnectionString = "Driver={Microsoft ODBC for
Oracle};Server=oed1;UID=MyUsername;pwd=MyPassword"
' how long to wait before the connection dies
conn.ConnectionTimeout = 30
conn.Open
If conn.state = adStateOpen Then
' if the connection succeeds
    MsgBox "Database Connection Successful...!"
Else
' if the connection doesn't work
    MsgBox "Sorry, can't connect to the database"
End If
recset.Open "select * from employee where department<>'Manufacturing'
order by department, employeeid", conn
Do Until recset.EOF
    picResults.Print recset!employeeid, recset!employeelast,
recset!employeefirst, recset!department, recset!teamid
    recset.MoveNext
Loop
'MsgBox "all done"
recset.Close
conn.Close
Set recset = Nothing
Set conn = Nothing
'Set cmd = Nothing
End Sub

 
 
 

1. Need help with ADO connection

Can someone tell me what the heck is wrong with the code below? I keep
getting an "Datasource name not found and no default driver specified". I
have tried every damn way I can think of to be able to use App.Path to my
database but I keep getting this error. If I go with the wizard which set's
a fixed path then everything works fine but I don't want a fixed path.
Thanks

Dim db As ADODB.Connection
    Dim rs As ADODB.Recordset
    Set db = New ADODB.Recordset
    db.Provider = "Microsoft.jet.OLEDB.4.0"
    db.Open App.Path & "\Scheduling.mdb", "admin", ""
        Connectstring = "Provider=" & _
        "Microsoft.jet.OLEDB." & _
        "4.0;data source=" & _
        App.Path & "\Scheduling.mdb"

2. Mimer SQL DATE Datatype Problem

3. Access Database, ADO-ODBC, Connection string help needed ...

4. ADO with DLL problem

5. need help,question of connections of ADO

6. Are there any syntax checkers on the market

7. Need help with connection string ADO

8. Need help with ADO/ODBC connection

9. Need help with ADO Connection of a distributable application

10. Detect dropped ADO Connections

11. ADO SQL Dropping Connection

12. ADO SQL 7 Dropped Connection