I need HELP FAST !!!???
Posted by: zack pulaski
Date: October 21, 2010 04:57PM

I made a login system in visual basic 2010 and when i run the program and type my login details that i put in my database online and i get this error.........

p.s it says this when it hits this line.... Mydata = command.ExecuteReader

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''select * From users WHERE Username= & UsernameTextBox.Text & AND Password= & Pa' at line 1'

Here is the code that i used to make the program...............

Imports System.Data.SqlClient
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=acehacks.com;Port=3306; user id=wishbone_zackwp; password=zackwp; database=wishbone_AHUsers"
MySqlConnection.Open()


Dim Myadapter As New MySqlDataAdapter
Dim sqlquary = "'select * From users 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("Error! Wrong Login Info Please Try Again")
Else
Form1.Show()
Me.Close()
End If
End Sub


Plz respond fast thanks zack



Edited 1 time(s). Last edit at 10/21/2010 05:02PM by zack pulaski.

Options: ReplyQuote


Subject
Views
Written By
Posted
I need HELP FAST !!!???
979
October 21, 2010 04:57PM
469
November 05, 2010 05:23PM
387
December 02, 2010 01:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.