public void Btn_SubmitClick(Object sender, EventArgs E) { string path = @"C:\TEMP\OneWayContainers.xls"; string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;"; OleDbConnection objConn = new OleDbConnection(connStr); objConn.Open(); OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM MyRange", objConn); OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(); objAdapter1.SelectCommand = objCmdSelect; DataSet objDataset1 = new DataSet(); objAdapter1.Fill(objDataset1, "XLData"); string strExcelContainerInfo=""; strContainerInfoText= _SendContainerInfo.Value; if(objDataset1.Tables[0].Rows.Count>0) { for (int i = 0; i < objDataset1.Tables[0].Rows.Count; i++) { strExcelContainerInfo = Convert.ToString(objDataset1.Tables[0].Rows[i]["OneWayContainers"].ToString()); if (strContainerInfoText.Contains(strExcelContainerInfo) ) { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert","alert('Container: "+strExcelContainerInfo+" is a one-way container.');window.location='Redirect.aspx';", true); break; } else { continue; } } if ( (string)Session["Fullname"] == null ||(string)Session["Fullname"] == "") { reCheckSession(); return; } else { Logic to send confirmation email } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)