M
Materialised
Hello everyone,
I am having a issue inserting values into a MYSQL table, and for the life of
me, I can figure out why. I know the connection is successful, however I am
getting errors.
The table has 4 fields, all of them are Text values.
Here is my code:
Dim myCommand As New MySqlCommand
myCommand.Connection = conn
myCommand.CommandText = "INSERT INTO Order(ONUM, Password, Email, Process) "
_
& "Values (" _
& "'" & txtOrder.Text & "', " _
& "'" & txtPassword.Text & "', " _
& "'" & txtEmail.Text & "', " _
& "'" & comStatus.SelectedItem & "')"
Try
conn.Open()
myCommand.ExecuteNonQuery()
Catch myerror As MySqlException
MsgBox("There was an error updating the database: " & myerror.Message)
End Try
And the error i recieve from it is as follows:
#42000You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'Order(ONUM, Password, Email, Process) Values ('353643', '353623542',
'test@here.' at line 1
I have also noticed that some of the data I enter on my form is shortened.
i.e the email address I actually entered on the form was (e-mail address removed)
however the error message only displays test@here.
Could anyone help me with my issue?
Regards
I am having a issue inserting values into a MYSQL table, and for the life of
me, I can figure out why. I know the connection is successful, however I am
getting errors.
The table has 4 fields, all of them are Text values.
Here is my code:
Dim myCommand As New MySqlCommand
myCommand.Connection = conn
myCommand.CommandText = "INSERT INTO Order(ONUM, Password, Email, Process) "
_
& "Values (" _
& "'" & txtOrder.Text & "', " _
& "'" & txtPassword.Text & "', " _
& "'" & txtEmail.Text & "', " _
& "'" & comStatus.SelectedItem & "')"
Try
conn.Open()
myCommand.ExecuteNonQuery()
Catch myerror As MySqlException
MsgBox("There was an error updating the database: " & myerror.Message)
End Try
And the error i recieve from it is as follows:
#42000You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'Order(ONUM, Password, Email, Process) Values ('353643', '353623542',
'test@here.' at line 1
I have also noticed that some of the data I enter on my form is shortened.
i.e the email address I actually entered on the form was (e-mail address removed)
however the error message only displays test@here.
Could anyone help me with my issue?
Regards