Posted on: 10/18/2013 4:19:02 AM | Views : 501

Hi

I am using following code to upload data from excel and its giving error
protected DataTable RetrieveData(string strConn) { DataTable dtExcel = new DataTable(); using (OleDbConnection conn = new OleDbConnection(strConn)) { OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", conn); da.Fill(dtExcel); } return dtExcel; }
protected void Button10_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { string strFileName = Server.HtmlEncode(FileUpload1.FileName); string strExtension = Path.GetExtension(strFileName); if (strExtension != ".xls" && strExtension != ".xlsx") { Response.Write("<script>alert('Please select a Excel Spreadsheet to import!');</script>"); return; } string strUploadFileName = "~/images/" + DateTime.Now.ToString("yyyyMMd ...

Go to the complete details ...