Flag This Hub

how to connect vb with mysql?

By


1) Download the free ODBC Driver from MySQL website (link below).

2) Get the connection string from the other link below. I'm assuming you know ADO how to create connection objects.

3) You might be running MySQL on your machine, or on a remote server. If running on a remote server, you might have to go to CPanel, and authorize your remote IPAddress.

4) Consider upgrading to VB.NET, but you still need the same info above.

Comments

abdi 3 years ago

hello. hi there.

i want know. for example if you create an sql database containing some data about the dailly transsaction of a cofe shop e.g no of tea, coffees and sandwichs sold. can you then connect thi data to a visual basic application so that can intract with data.

Kloon 3 years ago

Stoeme Kloon!!!!

ANNA 2 years ago

HOW TO MAKE AN INVENTORY SYSTEM THAT MAY CONNECT TO VISUAL BASIC?

mmmmmmmmm 2 years ago

kkkkkkkkkkkkkkk

WERE 2 years ago

HOW CAN CONNECT MYSQL FROM VISUAL BASIC?

unknown 2 years ago

' put the following in a module

Option Explicit

Dim conn As ADODB.Connection

Dim rs As ADODB.Recordset

Dim username As String

Dim passwd As String

Dim serverIP As String

Dim db As String

Public Function connectMysql(username As String, passwd As String, serverIP As String, db As String, conn As ADODB.Connection, rs As ADODB.Recordset)

Set conn = New ADODB.Connection

Set rs = New ADODB.Recordset

conn.CursorLocation = adUseClient

conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & serverIP & ";UID=" & username & ";PWD=" & passwd & ";DATABASE=" & db & ";" _

& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841

conn.Open

End Function

' put this in your form

Dim conn As ADODB.Connection

Dim rs As ADODB.Recordset

Dim username As String

Dim passwd As String

Dim serverIP As String

Dim db As String

Dim ssql As String

Private Sub Form_Load()

Call connectMysql("root", "", "127.0.0.1", "myerp", conn, rs)

ssql = "SELECT * FROM accmaster"

rs.Open ssql, conn

Set DataGrid1.DataSource = rs

End Sub

dudz 14 months ago

great! continue it.

lisyezhang 12 months ago

thankyou...!

prabhakaran 10 months ago

how i am understand? what is link to the program and physical connection

Aprill 8 months ago

How can I connect a vb application to a Mysql database?

I badly need an answer!

thanks in advanced for the response!!!

Please,I need a clear explanation. :)

TG 7 months ago

Hi i'm a novice in vb programming. i've not work with mysql before but i want to know the steps in creating the table, and connecting it to vb6. Please i need a reply.

dlman 3 months ago

this is really useful for me as well thank u.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working