Quick question...
Say I have a login form with a user ID, then a text box on the main form.
When the main form closes, it takes that value from the text box and inserts it into the column based on that users ID
Here's my code-
'// Save mileage to DB
MySqlConnection.ConnectionString = x.urlMySQLDatabase
Try
MySqlConnection.Open()
Catch ex As Exception
MsgBox("It looks like your internet is taking a second to get squared away... ")
End Try
MySqlCommand.Connection = MySqlConnection
MySqlDataAdapter = New MySqlDataAdapter _
("INSERT INTO Users.id = " & lblID.Text & " mileage VALUES ?" & txtEndMiles.Text & ";", MySqlConnection)
MySqlCommand.Parameters.AddWithValue("?mileage", txtEndMiles.Text)
Try
MySqlCommand.ExecuteNonQuery()
Catch ex As Exception
' no error message yet- pending
Finally
MySqlConnection.Close()
End Try
'// End save mileage to DB
So I guess my question is, can some take a look at my INSERT statement for me?
Each row in the database has an id column and mileage column.
lblID.Text is the users ID number, it shows on the main form, so I figured I could use that value,
txtEndMiles.Text is the text box on the main form.
mileage is the column in the database to store that value.
("INSERT INTO Users.id = " & lblID.Text & " mileage VALUES ?" & txtEndMiles.Text & ";", MySqlConnection)
MySqlCommand.Parameters.AddWithValue("?mileage", txtEndMiles.Text)