protected void btnLoad1_Click(Object Sender, EventArgs e) { string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\\Mnemonic.xls;Extended Properties=Excel 8.0;"; OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Mnemonic$]", strConn); DataSet ds = new DataSet(); myCommand.Fill(ds, "ExcelInfo"); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr[0].ToString().Trim() == "") { break; } string strCode = dr[0].ToString().Trim(); string strName = dr[1].ToString().Trim(); DataSet dsImport = oMnemonic.Get(strName, strCode); if (dsImport.Tables[0].Rows.Count == 0) { oMnemonic.Add(strName, strCode, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1); intCount++; } else { intDuplicate++; } } Response.Write("Done = " + intCount.ToString() + "<br/>"); Response.Write("Duplicate = " + intDuplicate.ToString() + "<br/>"); }
protected void btnAdd_Click(Object Sender, EventArgs e) { if (intID == 0) { oMnemonic.Add(txtName.Text, txtFactoryCode.Text, Status.Text, ResRating.Text, DRRating.Text, Infrastructure.Text, CriticalityFactor.Text, Platform.Text, CICS.Text, PagerLevel.Text, ATLName.Text, PMName.Text, FMName.Text, DMName.Text, CIO.Text, AppOwner.Text, AppLOBName.Text, Segment1.Text, RiskManager.Text, BRContact.Text, AppRating.Text, Source.Text, OriginalApp.Text, (chkEnabled.Checked ? 1 : 0)); } else { oMnemonic.Update(intID, txtName.Text, txtFactoryCode.Text, Status.Text, ResRating.Text, DRRating.Text, Infrastructure.Text, CriticalityFactor.Text, Platform.Text, CICS.Text, PagerLevel.Text, ATLName.Text, PMName.Text, FMName.Text, DMName.Text, CIO.Text, AppOwner.Text, AppLOBName.Text, Segment1.Text, RiskManager.Text, BRContact.Text, AppRating.Text, Source.Text, OriginalApp.Text, (chkEnabled.Checked ? 1 : 0)); } Response.Redirect(Request.Path); }