private void MyCmdGuardar_Click() { try { if ((string.IsNullOrEmpty(txtArea0)) || (string.IsNullOrEmpty(txtArea1)) || (string.IsNullOrEmpty(txtArea2))) { return; } string myArea = string.Empty; string myDesc = string.Empty; string myPrecintos = string.Empty; string myElectivePositionID = "0"; string myDemarcationID = "0"; string myWhere = string.Empty; myWhere = _IsInsert == false?cbArea_Item.Substring(0, 4) : ""; myArea = string.Concat(txtArea0, txtArea1); myDesc = txtArea2; foreach (Precintos p in lsValidPrecints.ToList()) { myPrecintos += p.ToString().Split('-')[0].Trim() + "|"; } bool myUpDate = false; using (SqlExcuteCommand mySqlExe = new SqlExcuteCommand() { DBCnnStr = _DBEndososCnnStr }) { myUpDate = mySqlExe.MyChangeArea(_IsInsert, myArea, myDesc, myPrecintos, myElectivePositionID, myDemarcationID, myWhere); if (myUpDate) { _MyAreasTable = mySqlExe.MyGetAreas(false); cbArea.Clear(); foreach (DataRow row in _MyAreasTable.Rows) { cbArea.Add(row[0].ToString()); } } } if (!myUpDate) { throw new Exception("Error en la Base de Data"); } MyReset(); MessageBox.Show("Done...", "Save", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }