Just trying to get a simple MySql database connection working from VB.NET 2008.
I have MySql running on XAMPP, so it should be possible for me to connect to it using VB.NET right?
It's a very simple "enter username and pass and check details" program, written purely as a simple example with which to incorporate a dBase connection. There is no username/pass and like I said, I'm trying to connect via my localhost.
Here is what I have, and basically, it's just not finding the server. Is the software I have installed (XAMPP + MySql) enough? Or is there something I'm missing?
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class Form1
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim loginSuccess As Boolean
myConnection = New SqlConnection("Server=localhost;Database=users;")
myCommand = New SqlCommand("SELECT password FROM details WHERE user=" & txtUser.Text, myConnection)
myConnection.Open()
If txtPass.Text = myCommand.ToString Then
loginSuccess = True
lblStatus.Text = "Login Successful"
Else
loginSuccess = False
lblStatus.Text = "Login Failed"
End If
End Sub
End Class
Thanks in advance,
so1i :)


Sign In
Create Account


Back to top









