How do I fix this error in Access and vb

1

I need help with the following error in the following images the code in which the error occurs is displayed

    
asked by Yuleidy Dayanne Mrquez Montepe 23.07.2016 в 07:01
source

1 answer

1

What I can say is that you should use parameters, concatenate the DELETE values in the string is not a good practice

Dim eliminar As String = "DELETE FROM cuarto WHERE id = @Id"
Dim c As New oleDbCommand(eliminar, conexion)
c.parameters.AddWithValue("@Id", Convert.Toint32(textid.Text))
c.ExecuteNonQuery()

It is also important to assign the parameter respecting the data type, if the id field is numeric you must assign the parameter with a valid number

Note: if the id is nuemrico, remove the single quotes

    
answered by 23.07.2016 в 07:52