MySQL Forums
Forum List  »  Connector/ODBC

Re: OpenDatabase Method in VBA fails
Posted by: Alexandre Lopes
Date: November 07, 2004 09:44AM

First, add references to "Microsoft ActiveX Data Objects 2.x Library";
Second, use:

Dim db As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim connString As String
conString = "DSN=myDsnName;DESC=Learning with Alexandre;DATABASE=myDatabase;SERVER=mydb.servername.com.br(or IP);UID=root;PASSWORD=myPassword;PORT=xxxx;OPTION=x;STMT=;"
db.Open connString, "root", "myPassword"
Rs.ActiveConnection = db
Rs.Source = "select * from myTable"
Rs.Open
MsgBox Rs(0)
Rs.Close

Good luck :)
Alexandre Lopes GEsTaPO

Options: ReplyQuote


Subject
Written By
Posted
Re: OpenDatabase Method in VBA fails
November 07, 2004 09:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.