private void UpdateDatabase() { // Get Ids int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); int companyId = Int32.Parse(hdfCompanyId.Value); Int64 countryId = int.Parse(hdfCountryId.Value); Int64? provinceId = null; if (hdfProvinceId.Value != "") provinceId = Int64.Parse(hdfProvinceId.Value); Int64? countyId = null; if (hdfCountyId.Value != "") countyId = Int64.Parse(hdfCountyId.Value); Int64? cityId = null; if (hdfCityId.Value != "") cityId = Int64.Parse(hdfCityId.Value); // Update DB DB.Open(); DB.BeginTransaction(); try { FlatSectionJls flatSectionJls = new FlatSectionJls(flatSectionJlsTDS); flatSectionJls.UpdateDirect(countryId, provinceId, countyId, cityId, projectId, companyId); DB.CommitTransaction(); flatSectionJlsTDS.AcceptChanges(); // Store datasets Session["flatSectionJlsTDS"] = flatSectionJlsTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }