I am trying to make a login system mysql try to connect to a mysql database.
Here is my code:
Imports MySql.Data.MySqlClient Public Class LoginForm1 Dim MySqlConnection As MySqlConnection Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click MySqlConnection = New MySqlConnection() MySqlConnection.ConnectionString = "server=***************; user id=**********; password=**; database=fpsskill_n;" Try MySqlConnection.Open() MessageBox.Show("Connection to Database has been opened.") Catch myerror As MySqlException MessageBox.Show("Cannot connect to database: " & myerror.Message) End Try Dim myadapter As New MySqlDataAdapter Dim sqlquary = "SELECT * FROM user WHERE username = '" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';" Dim command As New MySqlCommand command.Connection = MySqlConnection command.CommandText = sqlquary myadapter.SelectCommand = command Dim mydata As MySqlDataReader mydata = command.ExecuteReader() If mydata.HasRows = 0 Then MsgBox("Invalid user") Else MsgBox("Welcome user") End If End Sub End Class
And when i send it to my friends it give them a error:
Look the image:
Is there anyway to fix it?
This post has been edited by Fiodor941: 03 May 2010 - 06:11 PM