how to connect vb with mysql?
By NealWalters
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.
- http://www.connectionstrings.com/?carrier=mysql
ConnectionStrings.com - connection strings for MySQL - http://dev.mysql.com/downloads/connector/odbc/3.51.html
Download for the ODBC Driver for MySQL 3.51 - http://CMSTrainingVideos.com
My website where I show videos on how to do CPanel, teach MySQL, and other interesting subjects. - http://NealWalters.com
My book reviews
Comments
Stoeme Kloon!!!!
HOW TO MAKE AN INVENTORY SYSTEM THAT MAY CONNECT TO VISUAL BASIC?
kkkkkkkkkkkkkkk
HOW CAN CONNECT MYSQL FROM VISUAL BASIC?
' 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
great! continue it.
thankyou...!
how i am understand? what is link to the program and physical connection
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. :)
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.
this is really useful for me as well thank u.
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.