private void SaveData() { DataTable DTLocal = null; DataView DVLocal = null; DataRow DRLocal = null; System.Web.UI.Page this_page_ref = null; string strSQL = ""; try { DTLocal = new DataTable(); DVLocal = new DataView(); strSQL = "select * from tblSpareParts where SPCode='" + txtSparePartsCode.Text.Trim() + "'"; ConManager.DBConnection("TERMSHR"); ConManager.OpenDataTableThroughAdapter(strSQL, out DTLocal, true); DTLocal.TableName = "SpareParts"; ConManager.CloseConnection(); DVLocal.Table = DTLocal; if (DVLocal.Count == 0) { for (int i = 0; i < grdViewSpareParts.Rows.Count; i++) { NewSparePartsCode(); DRLocal = DTLocal.NewRow(); DRLocal["SPCode"] = txtSparePartsCode.Text.Trim(); DRLocal["MTCode"] = grdViewSpareParts.Rows[i].Cells[1].Text.Trim(); DRLocal["SpareParts"] = grdViewSpareParts.Rows[i].Cells[2].Text.Trim(); DTLocal.Rows.Add(DRLocal); } } else { for (int i = 0; i < grdViewSpareParts.Rows.Count; i++) { DRLocal = DVLocal[0].Row; DRLocal.BeginEdit(); CheckBox cb = (CheckBox)grdViewSpareParts.Rows[i].Cells[0].FindControl("chkCheck"); if (cb.Checked) { DRLocal["SPCode"] = txtSparePartsCode.Text.Trim(); DRLocal["MTCode"] = grdViewSpareParts.Rows[i].Cells[1].Text.Trim(); DRLocal["SpareParts"] = grdViewSpareParts.Rows[i].Cells[2].Text.Trim(); } DRLocal.EndEdit(); } } ConManager.DBConnection("TERMSHR"); ConManager.SaveDataTableThroughAdapter(ref DTLocal, true); ConManager.CloseConnection(); } catch (Exception ex) { throw ex; } finally { // } }
ConManager
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)