Well send me this error message
"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 'id_raza = 8' at line 1 "
This is my method to update
public bool Actualizar(string consulta)
{
bool actualizado = false;
int rows = 0;
conexion.Open();
cmd = new MySqlCommand(consulta, conexion);
rows = cmd.ExecuteNonQuery();
if (rows > 0)
{
actualizado = true;
}
conexion.Close();
return actualizado;
}
}
}
now what I do when I click on the update button
private void txbActualizar_Click(object sender, EventArgs e)
{
string actualizar = "UPDATE raza SET raza =" + txtRaza.Text + "WHERE id_raza =" + txtIdraza.Text;
if (fn.Actualizar(actualizar))
{
MessageBox.Show("Actualizado");
}
else
{
MessageBox.Show("Error al actualizar");
}
}
}
}
Good txtRaza
= the value that I put for texbox txtIdraza = the value that I put for texbox
my table in the MySQL DB has the following fields
id_raza= int,llave primaria,autoincrementable
raza=varchar
when I put in the id the value 8 that has already saved in the bd and any name for race the error is generated, I do not know where the error is