Thursday, October 1, 2009

Connection Visual Basic 6.0 With MySql Database


Connection Visual Basic 6.0 With MySql Database.


Then create a form , add a adodc component and a command button, see picture below.




Write this code to command button procedure.

Private Sub Command1_Click()
Dim myConnection As New ADODB.Connection
Set myConnection = New ADODB.Connection
myConnection.ConnectionString = "Provider=MSDASQL.1;" & _
"Persist Security Info=False;Data Source=yourdatasourcename"
myConnection.Open
  
    If myConnection.State = adStateOpen Then
        MsgBox "Connection Success"
    Else
        MsgBox "Connection Failed"
    End If
    myConnection.Close


End Sub


Download source


For any question comment this post..!

0 comments:

Your Ad Here