Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. private void btnactualizar_Click(object sender, EventArgs e)
  2. {
  3. int resp;
  4. asignarDatosObjeto();
  5. resp = CATCAD.Actualizar(CATCRN);
  6. if (resp == 1)
  7. {
  8. UpdateDGV();
  9. }
  10. else
  11. {
  12. MessageBox.Show("Imposible conectarse a la base de datos: " + CATCAD.error,
  13. "Fallo la conexion", MessageBoxButtons.OK, MessageBoxIcon.Error);
  14. this.Close();
  15. }
  16. }
  17.  
  18.  
  19.  
  20.  
  21. public int Actualizar(CatalogoCRN dispObj)
  22. {
  23.  
  24. SqlCommand UpdateCad;
  25. string comandoSql;
  26. try
  27. {
  28.  
  29. comandoSql = string.Format("Call SP_ACTUALIZAR('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')",
  30. dispObj.numFactura, dispObj.nameClient, dispObj.numPart, dispObj.tipMaterial, dispObj.DescriptionESp,
  31. dispObj.DescriptionUSA,dispObj.quantity,dispObj.UnitPrice, dispObj.numPallet, dispObj.date,dispObj.observations,dispObj.country);
  32.  
  33. connectionSql.Open();
  34. UpdateCad = new SqlCommand(comandoSql, connectionSql);
  35. UpdateCad.ExecuteNonQuery();
  36. connectionSql.Close();
  37. return 1;
  38. }
  39. catch (Exception ex)
  40. {
  41. error = ex.Message;
  42. return 0;
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement