public void guardar(getset mo) { string strl = "guardaru"; SqlCommand cmd = new SqlCommand(strl, cnx); cnx.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@nomb", mo.nomb); cmd.Parameters.AddWithValue("@apell", mo.apell); cmd.Parameters.AddWithValue("@direcc", mo.direcc); cmd.Parameters.AddWithValue("@tel", mo.tel); cmd.ExecuteNonQuery(); cnx.Close(); }
private void btnguar_Click(object sender, EventArgs e) { try { getset mo = new getset(); conccion da = new conccion(); mo.nomb = txtnomb.Text; mo.apell = txtapell.Text; mo.direcc = txtdirec.Text; mo.tel = int.Parse(txttel.Text); da.guardar(mo); MessageBox.Show("Datos guardar"); } catch (SqlException ex) { MessageBox.Show(ex.Message); } }