This is my problem, I have created a database which has 2 tables, the information of both tables shows it in a DATAGRIDVIEW that believes in visual studio, all right up there, now what I want to do is update the records I have in my DATAGRIDVIEW, create a stored procedure:
DROP PROCEDURE IF EXISTS sp_ActualizarContacto; CREATE PROCEDURE
sp_ActualizarContacto(
IN p_nombre VARCHAR (500), IN p_telefono INT (20), IN p_email VARCHAR
(500), IN p_tipocontacto VARCHAR (500))
BEGIN
>
UPDATE contacto SET nombre = p_nombre, telefono = p_telefono, email =
p_email, tipoContacto = p_tipocontacto WHERE p_id = id_contacto;
END
Well, with that procedure I call it from visualstudio on a button that thinks it's called updating, this is the code:
private void btnActualizar_Click(object sender, EventArgs e)
{
string query_actualizar = "CALL sp_ActualizarContacto";
try
{
MySqlCommand cmd = new MySqlCommand(query_actualizar, conectar);
conectar.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("El contacto seleccionado se ha modificado exitosamente");
mostrarContactos();
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message + "" + ex.Number);
}
finally
{
conectar.Close();
}
}
But it does not update anything in the GRIDVIEW and it throws me the sig, error:
INCORRECT NUMBER OF ARGUMENTS FOR PROCEDURE
CONTACTOS.SP_ACTUALIZARCONTACTO; EXPECTED 4 GOT 0 1318