|
-
April 9th, 2001, 02:24 AM
#1
ADO/RDO connection to server for a mysql db
Hi ,
I am currently involved in a project using vb6 and mysql . I have an local application which i want to connect to a database on the server , I would like to know how to connect a local database to database on server using vb.
-
April 9th, 2001, 08:43 AM
#2
Re: ADO/RDO connection to server for a mysql db
First you will need to download the ODBC drivers for mySQL. They can be found here.
http://www.mysql.com/downloads/api-myodbc.html
Next you will need to set up a DSN for the database. I used a System DSN and configured it like...
Windows DSN name (anything you like)
MySQL Host (Server Name or IP)
MySQL Database Name (The Name of your Database)
Add your Username and Password and you should be ready to go.
Hope this helps
-
April 10th, 2001, 09:29 PM
#3
Re: ADO/RDO connection to server for a mysql db
Thanx but i've done all those things and stil couldn't access the database. When I try to a mesage with an adodc headline saying that i can't access the server/computer/database comes out. Any ideas?
-
April 11th, 2001, 07:00 AM
#4
Re: ADO/RDO connection to server for a mysql db
Have you tried your ODBC connection with any other Application? In fact, in VB6, you can use the data manager to see if you can connect to the database. Also, depending on setup, the database/tables may be case sensitive. The data manager can definately help in building the form or getting the correct Connection String. Here is some short code showing you how to do this using RDO 2.0
public TC as RDO.rdoConnection
public TR as RDO.rdoResultset
public TQ as RDO.rdoQuery
private Sub Form_Load()
set TC = new rdoConnection
set TQ = new RDO.rdoQuery
TC.Connect = "DSN=PlaceDSNNameHere;DB=PlaceDatabaseNameHere;SERVER=PlaceServerNameHere;UID=PlaceUserIDHere;PWD=PlacePassWordHere;PORT=;option=0;STMT=;"
TC.CursorDriver = rdUseOdbc
TC.EstablishConnection
TQ.SQL = "SELECT * FROM Employees;" ' Select all from Employees Table
set TQ.ActiveConnection = TC
TQ.Execute
set TR = TQ.OpenResultset(rdOpenForwardOnly, rdConcurReadOnly)
TR.MoveNext
Debug.print TR!LastName
TR.Close
TQ.Close
TC.Close
End Sub
Hope this helps!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|