I am going to update a form with Vb.Net and Mysql, but it gives me the following error " Parameter ?nombre_lugar WHERE must be defined
" and well, it does not allow editing
This is my query;
Dim connstr As String = ConfigurationManager.ConnectionStrings("db").ConnectionString
Dim txt_id_lugar = CType(editableItem.FindControl("txt_id_lugar"), TextBox)
Dim txt_nombre_lugar = CType(editableItem.FindControl("txt_nombre_lugar"), TextBox)
Dim lbl_error = CType(editableItem.FindControl("lblErr1"), Label)
sqlQuery = "UPDATE t_salas set nombre_lugar = ?nombre_lugar"
sqlQuery = sqlQuery & "WHERE id_lugar=?id_lugar"
myconn = New MySqlConnection(connstr)
myconn.Open()
mycommand = New MySqlCommand(sqlQuery, myconn)
mycommand.Parameters.AddWithValue("?id_lugar", txt_id_lugar.Text)
mycommand.Parameters.AddWithValue("?nombre_lugar", txt_nombre_lugar.Text)
The error was that the following happened, the parameter and the WHERE were pasted, forming a single word and well, I gave it a space as is and it worked :/