jimseiwert
asked on
VB.NET MySql Store Procedure
It is my first time having to call a mysql store procedure from vb.net. I am trying to use the below code but it keeps saying
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 'SP_Validate_user' at line 1
What am i doing wrong? The store procedure does not show any problems. It commited successful
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 'SP_Validate_user' at line 1
What am i doing wrong? The store procedure does not show any problems. It commited successful
Imports MySql.Data
Imports MySql.Data.MySqlClient
Public Shared Function validate_user_credentials(ByVal username As String, ByVal password As String) As Boolean
Dim myConnection As New MySqlConnection
myConnection = New MySqlConnection(myConnectionString)
Dim myCommand As New MySqlCommand("SP_Validate_user")
myCommand.Connection = myConnection
myConnection.Open()
myCommand.Parameters.AddWithValue("Username", username)
myCommand.Parameters.AddWithValue("UPassword", password)
Dim sqlReader As MySql.Data.MySqlClient.MySqlDataReader = myCommand.ExecuteReader
While sqlReader.Read()
MsgBox(sqlReader(0))
MsgBox(sqlReader(1))
End While
myCommand.Connection.Close()
sqlReader = Nothing
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this
Dim myConnection As New MySqlConnection
myConnection = New MySqlConnection(myConnecti onString)
Dim myCommand As New MySqlCommand(" Call SP_Validate_user('&usernam e&"','"&pa ssword"')"
myCommand.CommandType = CommandType.StoredProcedur e;
myCommand.Connection = myConnection
myConnection.Open()
Dim myConnection As New MySqlConnection
myConnection = New MySqlConnection(myConnecti
Dim myCommand As New MySqlCommand(" Call SP_Validate_user('&usernam
myCommand.CommandType = CommandType.StoredProcedur
myCommand.Connection = myConnection
myConnection.Open()
http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-1
Great is our GOD.
:)