Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

ADODB Connecting To Mysql

Anybody knows the connection string to connect to a mysql database??

Thank you,
Guilherme Costa

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Get Data From Mysql Without Connecting To Mysql Directly
I want to get some data from mysql but unfortunately my hosting company doesn't allow vb6 to connect to mysql. Could any one tell me what other ways i have to get data from mysql using php and use it in vb6 application.Thanks

How To Get Data From Mysql Without Connecting To Mysql Directly
I want to get some data from mysql but unfortnetly my hosting company dosn't allow vb6 to connect to mysql. Could any one tell me what other ways i have to get data from mysql using php and use it in vb6 application.Thanks

cn.Execute("Insert Into Table1 Values('value')")

OK Its vorking.

How about:

For a=1 to 100
cn.Execute("Insert Into Table1 Values('value')")
next a

not all 100 values are inserted because of flood

Question: How to insert all 100 values?

Adodb Mysql
how to do an adodb and mysql connection ?

Edited by - ganero on 1/12/2007 10:54:53 PM

Vb + Mysql Using Adodb Or Adodc?
Is there any way to do it?

I installed the driver provided by mysql dev and acording to them i should use something like this for the connection string:

DRIVER={MySQL ODBC 3.51 Driver};SERVER=ip;DATABASE=databaseName;UID=username;PWD=password;OPTION=16384

The record source i'm using is the query itself:

SELECT distinct(name), address FROM `fieldName`;

But this gives me an error saying that the query is wrong

Does anyone see any error there?

Data Report - Connecting In ADODB

I have a program which runs from MS Access DB. I would like to create a report for the data, but so far I get as far as adding the DataReport to the project but I can't link the fields to any of the ADODB DB in the other form as I don't really know how!! Also I need to be able to have commands to print all records using reports.

The connection is on frmReference::

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSql as String
Set db = New ADODB.Connection
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:db.mdb;Persist Security Info=False"
Set rs = New ADODB.Recordset
sSql = "Select * From tblReferences"
rs.Open sSql, db, adOpenDynamic

I really need help as to how to use reports!! Please! Thanks,


Connecting Excel And Vb 6.0 Using Adodb.Recordset
I have a Excel file named badvbills and it has a datasheet named badvbills.
Now i have a created a connection object using adodb.connection and a recordset object
using adodb.recordset object
The connection to the excel file is sucessfull.
I have written the following code to do it.
Dim ExcConn As ADODB.Connection
Dim rs As ADODB.Recordset

Set ExcConn = New ADODB.Connection
Set rs = New ADODB.Recordset

ExcConn.Provider = "Microsoft.Jet.OLEDB.4.0"
ExcConn.ConnectionString = "Data Source=" & txtFile & ";Extended Properties=Excel 8.0;"

But when i try to open the
recordset object using the above connectionobject it gives runtime error

The Microsoft Jet Database engine could not find the object 'badvbills' Make sure the object exists and that you spell its name and the path name correctly.
the code for opening the recordset is
rs.Open "Select * from badvbills", ExcConn, adOpenDynamic, adLockOptimistic

i m also attaching a copy of my project and excel file.
plz help me.


Give people more than they expect and do it cheerfully.

Edited by - Shandy on 4/4/2004 11:58:38 PM

Connecting To MS Access DB With Password Using ADODB
Hello, everybody!

I have an MS Access database, and I decided to password it for security reasons. I am using ADODB to connect to the database, here is the code:

Dim strConnString As String
    Dim objRecordSetAreaID As ADODB.Recordset
    Dim objRecordSetMobs As ADODB.Recordset
    Dim objConnection As ADODB.Connection
    strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "MyDB.mdb;"
    Set objConnection = New ADODB.Connection
    objConnection.Open strConnString, , "a"

Now, here's the error it gives me:

Run-Time error '-2147217843 (80040e4d)':

Cannot start your application. The workgroup information file is missing or opened exclusively by another user.

I do *not* have the database opened in Access at the moment, and I am not even specifying the user name. Or should I be?

I'm pretty much lost here.

I'd appreciate any help,
Thanks in advance,


Trouble Using ADODB And Connecting To A Recordset
I'm getting a data type mismatch error when I try to execute this command. Basically, I'm trying to take a value entered into a text box in a form and find out if that value exists in table OCL within the same database. If the value exists then do x, if not then do y. I'm using Access 2002 and VBA. The datatype mismatch error points me to the SQL statement. Any help would be greatly appreciated!

Code below:
Private Sub Command3_Click()
Dim rstOCL As ADODB.Recordset
Dim blnFound As Boolean
Dim fldOffer_Tracking_Number As ADODB.Field

Set rstOCL = New ADODB.Recordset
rstOCL.Open "SELECT OCL.Offer_Tracking_Number FROM OCL WHERE OCL.Offer_Tracking_Number='" & Me.Offer_Tracking_Number & "'", _
                       CurrentProject.Connection, _
                       adOpenStatic, adLockReadOnly, adCmdText
With rstOCL
' Check each record
        While Not .EOF
            ' Check the name of the column
            For Each fldOffer_Tracking_Number In .Fields
                ' If the current column is Offer_Tracking_Number
                If fldOffer_Tracking_Number.Name = "Offer_Tracking_Number" Then
                    ' Check its value
                    ' If the current column holds the item number that the user entered
                    blnFound = True
                    End If
            ' In case you didn't find it, move to the next record
    End With
    ' Offer_Tracking_Number was not found, ...
    If blnFound = False Then
    DoCmd.Hourglass True
        'Turns off the Access warning messages
        DoCmd.SetWarnings False
            DoCmd.OpenQuery "Change Control"
    DoCmd.Hourglass False
        'Turns the Access warning messages back on
        DoCmd.SetWarnings True
    DoCmd.Hourglass True
        'Turns off the Access warning messages
        DoCmd.SetWarnings False
            DoCmd.OpenQuery "Change Control from OCL"
    DoCmd.Hourglass False
        'Turns the Access warning messages back on
        DoCmd.SetWarnings True
    End If
    Set rstStoreItems = Nothing
End Sub


Edited by - Geof on 5/2/2007 6:20:10 PM



MySQL, ADODB.conn And Crystal Reports
I have to select some records of a mySQL database, print a specific report for each of them and then write a "1" in a field indicating that the report has been printed.
I have two doubts:
1) What table is the one I have to use in Crystal Reports? How can I reference it?
2) Is my sentence correct to put a "1" only in those records I selected and printed?

See my code attached.

VB Connecting To MySQL

I started building a php rpg game and i decided that I'm going have the admin's panel in vb.. im not sure how I would go by connecting to MySQL and updating and retrieving information from mysql in VB6.. what is the simpliest way of doing this?

if someone has a tutorial on this it would be really good from me.. i looked around and the ones i seen was like way to advanced for me..

Thank you

Connecting To MySQL
have found some tutorials and example code on this but none have helped...

What i want to do is connect to a MySQL server (atcually online) from my computer without an ODBDC connection.

I then want to pull selected fields out of a table and put them in text boxes...

Every code i find either uses an ODBDC or does not work.

Any input guys ?? Thanks


VB And Connecting To A MySql
I am very new to this, so I am be asking a dumb question. But here is my situation.

I have a stand-alone windows application that uses a local MS Access as it source of Data. however I want to make my window application connect to a MySQL database on a webserver, so that if this application is installed in multiple locations, they can all use the MySQL database on the webserver to get the data.

Any thought on this. Your help is greatly appreciated.


Connecting To MySQL
hi to all,

im using mySQL as my database and i want to ask if there is anyway possible to connect to mySQL aside from the ODBC driver? I am just using a DSN connection string and pass it as an argument in the ADODC.connection object. Are there other ways to connect aside from the DSN connection? I have found out in the interenet that there are topics regarding connection to mySQL throug RDO(Remote Data objects), but i haven't throughly studied it yet. Besides, RDO is an older technology. I am looking forward to hearing from the experts here...thanks and god bless all...

Connecting With MySQL DB

i would like to know how to connect to a mysql database via a small VB program?

also one big thing is how can i make it so that if someone was to open my program in notepad it would be all encrypted so that no one can find password or were to connect to etc?

any help greatfull

Connecting To MYSQL
hi guyz,
i need someone to show me how to use vb in connecting to a SQL/MYSQL server.
i know i'll be needing winsock, what else(i.e. some example codes).


Connecting To MySQL
Can anyone direct me or give a code on how to connect to MySQL using Visual Basic.. If its possible using and not using ODBC.. tnx..

Connecting VB To MYSQL
Hey all,
I was wonder if this is possible,
I pay a hosting company to host my website and i have mysql setup on it. And was wondering if anyone knows where some sample code is of how i can access the fields in my database from a VBPROGRAM at home?

Connecting Vb And Mysql
Hoping youe could help me. I have the odbc connection code but i cant get them to connect! I must be entering wrong code some where, could you possible help my sending me a step by step notation on the matter? Anything would help, Many thanks!

Need Help On Connecting Vb To Mysql

I am new to vb & mysql
i need coding to connect mysql database to vb
kindly explane me the coding please


How To Connecting VB6 To My Mysql

     how can i connect VB6 to mysql which can later be used for web applications.


Connecting MySQL With VB6

I'm comfortable with VB6 and I am comfortable querying a MySQL database.

I want to integrate them together to write a VB6 database application.

Please excuse my ignorance. I need to know quite a lot.

Here are my questions.

I've installed MySQL on XP. Do I need to install a driver separately ?

Do I need to install some other software (eg ADO) to connect from VB6 to MySQL ?

(I'm hoping later on to move the database to a remote server to allow multiple connections but for now I just want to get it working locally)

I've noticed that connection strings tend to want servername. What is it ? localhost ?



Any pointers would be very welcome.

I am a newbie and want to know how to connect vb 6 to a mysql database. I have the odbc drivers.

Connecting To MySQL
 I'm not an expert on databases, but I think I'm doing good since I'm at this point to ask this question My friend has a domain and he set up a server, and I'm using a program called mySQL Query Browser to play around with the database. I'm doing basic SQL commands so I'm comfortable with it.

Now, my question is to be able to do all the commands I did in the mySQL Query Browser, buy in VB. Because my goal will be when the user opens my program its going to send some records to my database on a server.

This is the code I have that will send data to a database stored locally on my computer, but I don't know how to do it to tell it to go on the internet:


Private Sub insertIP(localIP As String, localPort As String, remoteIP As String, remotePort As String, theState As String, theDate As String)

Set m_adoCN = New ADODB.Connection
   With m_adoCN
      .Provider = _
      .ConnectionString = _
        App.Path & "db1.mdb"
   End With

' Open Recordset

   Set m_adoRS = New ADODB.Recordset
   With m_adoRS
      .ActiveConnection = m_adoCN
      .Source = _
         "INSERT INTO IP VALUES ('" + localIP + "','" + localPort + "','" + remoteIP + "','" + remotePort + "','" + theState + "','" + theDate + "')"
      .CursorLocation = adUseClient
      .CursorType = adOpenForwardOnly
      .LockType = adLockReadOnly
   End With

End Sub

Thanks in advance.    

Edited by - xterra on 10/26/2005 9:41:21 AM

Connecting To MySQL 4 In A LAN Using Vb6
Hi there! I just want to ask how to connect my Visual Basic program on a MySQL server. Here is my sample code:

mysqlstring = "DSN=exemption; DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=test; UID=root; PASSWORD=1234; OPTION=3}"
conn.ConnectionString = mysqlstring

It is the normal code I use if the database if on a pc itself with the program. But I wanted to know what about if the program is about to get the database on a local area network? What things I should change then on my code?

I have tried changing there the SERVER and instead of localhost I've tried putting the IP address of the computer where the database is and also tried putting the computer name instead but both are not working. Thanks for those who wanted to help! God Bless you all...

Connecting VB6-ASP And MySQL
How do i connect the three? I have a project that will use the three wares. ASP for my web, vb6 for my forms, and mySQL for my database.. HELP thanks!

Connecting To MySQL On Linux
We are planning to develop a system using VB6 as front end running on Win98 and Linux7.0 as Server With MySQL as RDBMS. Is this Possible? Is this an efficient set up on a large system? How can I connect? What softwares will i need? H E L P!

Connecting To A Linux/MySQL DB
Question folks. My boss is interested in setting up a VB App that'll allow the user to update a bunch of things onto an Access file and then be able to EXPORT the information to a Database that:

1) Is Online
2) Is a MySQL DB


3) Is running on a Linux Server

Now, My question is how can you establish this connection? Is this a FTP connection, or Winsock, or is this yet another ADO ConnectionString? All info will be greatly accepted.


Connecting To MySQL From Vb Via Internet
Greetings to you all,

I am using VB, I want to be able to hit a button in VB make a connection via the internet to a MySQL database located on a web server then, use an Appen query to go and check in an Access database for new records, take those new records from the Access database and Append them to the MySQL database on a remote web server via the internet.

Does someone know how this connection is made from VB to be able to connect to the MySQL database on the webserver via the internet???

Any assistance will be appreciated.

Connecting To MYSQL Database
Hi all,
Is this Possible to connect to Mysql database on Internet ?

I asked this question More Than 127 times In a lot of forums but no answer

Connecting To A MySQL Database
i know this has been asked before, but how do i do it??
i searched around the forum and managed to get this far:
i installed mySQL server and it seems to be working fine
i installed the odbc driver
now how do i make the connection in VB??
and, when i do connect, how do i add, remove, and retrieve info to and from my tables?

Connecting To MySQL Database
Hey guys, I'm running mySQL on my web server and I need to write a small VB application that can pull certain users email addresses from the database in order to email them. I am having some trouble getting started and was wondering if anyone could offer any advice as to how I can setup a connection to a mySQL database in VB 6.0. Thanks for your help!

Connecting To A MySQL Database
Can anyone help me connect to a MySQL database using Visual Basic?

Connecting To A MySQL Database
I'm supposed to make an application which would use data from a mySQL database on the server, so I need to figure out how to connect to it thru code first. I've never done this before (how can you tell?). I have myODBC drivers installed, and I've added the info about the database thru ODBC admin.
Any help will be appreaciated. Also, if you know of any tutorials on this type of a problem, I'd be more than happy to visit them

El Morte

VB Connecting MySql Via ODBC

Im trying to update my old VB6 system with DAO and MS-Access to ADO and MySql database.

Im using MySql ODBC 3.51.06 version, and its really so easy to retrieve some data from tables.

Is there a way to turn it much more faster?!?!? All tables have at least one index key.

Any suggestions will be great!
My best regards to all.

Connecting To A MySQL Database

I'm trying to connect to my MySQL database like this:

Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=host;" _
& "DATABASE=database;" _
& "UID=user;" _
& "PWD=password;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

I set my correct user, host, pwd etc... but it don't connect, what am I doing wrong?


Getting Error Connecting To MySQL Db
I'm trying to use a MySQL db with VB. I've downloaded the MySQL ODBC 3.51.06 Driver.

Here's my code:

Private Sub btnSubmit_Click()

On Error GoTo error1 '// error handling

Dim cid As ADODB.Connection
Dim sql As String
Set cid = New ADODB.Connection '// Assigns an object reference
Dim rs_ok As New ADODB.Recordset

cid.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=myserver;DATABASE=mydb;UID=myuserid;PWD=mypassword;OPTI ON=18475"

'// SQL statements
sql = "SELECT * FROM users"
'// execute sql statement
'rs_ok.Open sql, cid, adOpenKeyset, adLockPessimistic

Set rs_ok = cid.Execute(sql)

'// list all records from mySQL on the listbox

If rs_ok.RecordCount > 0 Then
Label1.Caption = "Invalid Login - Please Try Again!"
End If

error1: '// error handler
Debug.Print Err.Number & ": " & Err.Description

End Sub

The only error message I get is: 0:

The error must be an error in connecting to the db - when step through, it gets to the end - I get the "Invalid Login - Please Try Again!" message appearing.

Can anyone help?

Connecting To Mysql Database?
Hello guys,

Hoping to get some help on this...

I was wondering if someone could tell me how I can connect to mysql database from vb?

Let's say my mysql database is hosted @
with username: "bc101" and pass: "sample"

any help appreciated,


Connecting To Mysql Database
Hello, Could you please give me a sample code how to connect to my mysql database in my website. I want to access it, is it posible for me to save, update, or delete data using visual basic in my desktop computer that is connected to internet?

I really appreciate some help...

Connecting To MySQL Database
I've decided to take a leap into the world of VB and MySQL, but not really sure how to get started.

I don't know any of the basics, like how to connect to a remote MySQL database and how to run queries.

If anyone could help me I'd be very grateful, or if someone can point me in the direction of some tutorials, that explain how to use MySQL in VB.

Many thanks in advance,

Connecting To MySQL Database
I know this question had been asked hundreds of times before, I did some searching here on the form, and I think I am pretty close.

To make a long story short, I have a mySQL database on my server(on the internet), and I want to connect to it. I made the connection string, and I when I test I get an error message saying: "Can't connect to MySQL server on '' (10060)"

Here is my present code, with some minor changes to keep data anonymous:

VB Code:
Option ExplicitPrivate ADOCn As ADODB.ConnectionPrivate strConnString As StringPrivate strSQL As StringPrivate rsTempRecordSet As New ADODB.RecordsetPrivate cnTeamCMI As New ADODB.Connection Private Sub Form_Load()    strConnString = "DRIVER={MySQL ODBC 3.51 Driver};;PORT=3306;DATABASE=prefix_database; USER=prefix_username;PASSWORD=password;OPTION=3;"    Set ADOCn = New ADODB.Connection    ADOCn.ConnectionString = strConnString    ADOCn.OpenEnd Sub

Connecting To MySQL Databases
How can you make a login with a username and password that will connect to a MySQL database?

Connecting To A Mysql Database
Hello, before i ask, i have searched for this, and i didnt see what i was looking for.

Im comming back into VB 6, after a year of working with it, now, i dont have my book, im asking here, how can i connect to a MySQL database, and allow users to sign in, using their username and passwords for the forum software phpbb

Connecting To A MySQL Database Using VB6
Hi, I was just wondering if someone could guide me through a process of connecting to a MySQL database. I have the ODBC driver installed, but for some reason it gives me problems saying that the driver could not connect, so if someone could post a walkthrough that would be great. Thanks!

Connecting To A MySQL Database?
Anyone know how this is done? And how to get/check information from it, for a login script that is.

All help is welcome

Connecting To A MySQL Database...
Is this possible in VB. I don't want to use DAO to connect to a file database...any ideas?

Connecting To MySQL Database With VB.NET
Is this possible? If so, how can I do it?

Connecting To PostgresSQL Or MySQL
I want to *conncect* to a PostgresSQL or MySQL server which is running on another machine, which is easier to do, and is there a standard kind of method to use? I Have MySQLX and havent tried of yet.. Any ideas/tips/pointers/previous experience welcomed..

Copyright 2005-08, All rights reserved