|
-
May 30th, 2005, 07:55 AM
#1
Thread Starter
Junior Member
How to connect mysql database using vb?
Hi
I want to import data from mysql (in the localhost) to the a Word table, how can I connect to mysql? I have got mysql in my machine, odbc driver as well.
Help me please
Claire
-
May 30th, 2005, 08:10 AM
#2
Frenzied Member
Re: How to connect mysql database using vb?
Tengo mas preguntas que contestas
-
May 30th, 2005, 09:00 AM
#3
Thread Starter
Junior Member
Re: How to connect mysql database using vb?
Hi
Thanks for your reply.
I have had odbc driver in my machine. Here is my vb code for connection
Dim mConn As New MySQLconnection
mConn.ConnectionString = "Driver={MySQL ODBC 3.51Driver};Server=localhost;Database=mydb;Uid=myid;Pwd=myps;option=3"
mConn.Open
However I got error message, I am newer in this area, could you please correct my code? I know mConn is defined wrong, but how should I define it.
Thanks in advance
claire
-
May 30th, 2005, 07:23 PM
#4
Frenzied Member
Re: How to connect mysql database using vb?
From the second link I posted:
# ODBC 3.51 Local database:
"DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=myDatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"
# ODBC 3.51 Remote database:
"DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;"
Tengo mas preguntas que contestas
-
May 31st, 2005, 06:12 AM
#5
Thread Starter
Junior Member
Re: How to connect mysql database using vb?
Hi Salvelinus
Thanks a lot for your reply. If I use code below (I only need to connect to local host for the time being)
"DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=myDatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"
an error message: complile error: syntax error
I am applying this code in vb Editor in Word document, what I want to do is to connect mysql from the vb Editor using vb code, then I could try to get the data from mysql and put into table in the Word.
Please could you give me more detailed instruction? Many thanks in advance
Claire
-
May 31st, 2005, 07:48 AM
#6
Frenzied Member
Re: How to connect mysql database using vb?
Well, you'd have to substitute your db's name, password, etc, along with making sure your ODBC driver is 3.51, etc. We take data from Access & put it on MySql for the web, so don't know as much about pulling it into Word. Post some code.
Tengo mas preguntas que contestas
-
May 31st, 2005, 08:46 AM
#7
Thread Starter
Junior Member
Re: How to connect mysql database using vb?
Hi
Thanks. I have substituted my db's name, password, etc, and also I have odbc 3.51 installed, as I am using it with asp.net application. I used Access database with Word before, it works fine, just not familar with mysql. Anyway, thanks a lot
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
|