Solved

Best way to communicate data to and from VB6 running Access databases and a mySQL database on the web?

Posted on 2009-05-08
6
320 Views
Last Modified: 2012-05-06
The title pretty much says it.  I have a VB6 application that uses Access databases.  I now have the need to pass data to and from a mySQL database on a website.

I would need to import selected records (coded into Access through VB6), export new data to the database, and be able to update selected mySql records.

ODBC and all that does not seem to be an option as this app runs on 200+ stand-alone desktops across the US and I dont want to get into all the local modifications that would be necessary.  I have also read on this site that VB6, Access, and mysql dont play well together.  XML has been suggested to me as the best vehicle to use for the communication.  

I've found some solutions on this site for reading and creating XML data, so that is doable.  But is it the best way?

What's your advice, experts?

Thanks in advance for any help.
0
Comment
Question by:Skip_Laughlin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 24348839
Your VB6 app can communicate with MySQL, assuming your workstations have the necessary driver. In most cases, the best method is to use straight SQL to work with these records. Basically, you'd build an ADO Connection, then run your SQL on that Connection object:

Dim con As ADODB.Connection
Set con = New ADDOB.Connection

con.Execute "UPDATE SomeTable SET SomeField=SomeValue"

I've never really built a VB6 app with Access and MySQL, but I've built and consulted on several that work with Access and MSSQL. The concept is the same - you'll have a connection to the Access database, and one to the MySQL database.

XML is certainly a viable option for moving data ... however, depending on how much data you have, and how robust your knowledge of XML is, you may be better off with recordsets and straight SQL.
0
 

Author Comment

by:Skip_Laughlin
ID: 24355574
Thanks.  How would you set the path to the mysql database for the connection?  http://www.mywebsite.com\data\mysql.db  ??
0
 

Author Comment

by:Skip_Laughlin
ID: 24355739
I think I found it in another solution http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_DB/Q_20474332.html?sfQueryTermInfo=1+10+connect+databas+mysql+onlin+set
"Well, here's future reference info for those who come upon this question:

You will need the MyODBC ODBC driver and then just use a connection string:

MyODBC: http://www.mysql.com/downloads/api-myodbc-3.51.html

Sample connection code:

   Dim conn As ADODB.Connection
    Set conn = New ADODB.Connection
     
   Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
     
   conn.CursorLocation = adUseClient
    conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
            & "SERVER=127.0.0.1;" _
            & "DATABASE=test;" _
            & "UID=testuser;" _
            & "PWD=12345;" _
            & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
 
   conn.Open
     
   rs.Open "SELECT * FROM mytable WHERE 1=0", conn, adOpenStatic, adLockOptimistic

Check www.vbmysql.com for samplecode and articles on the subject."
Looks basically like what you suggested but includes VB statements. Do you concur, LSM?
 


 
0
 
LVL 84
ID: 24356028
Yes, that's the way you connect to a MySQL database.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question