|
-
Jul 28th, 2011, 09:29 AM
#1
Thread Starter
Lively Member
[RESOLVED] How do I connect a form to mysql database?
Howdy,
I've followed a guide as to how I connect a form to mysql as per:
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
TestConnection()
End Sub
Public Sub TestConnection()
Try
Dim connStr As String = "Database=ClockInOut;" & _
"Data Source=192.168.0.87;" & _
"User Id=Username;Password=Password"
Dim connection As New MySqlConnection(connStr)
connection.Open()
connection.Close()
MsgBox("Connection is okay.")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
And when I launch the form I get the error "unable to connect to the specified hosts"
Does anyone have any ideas?
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
|