| Author: Roshan R Mhatre 02 Jun 2008 | Member Level: Gold Points : 2 |
string Exceldb = Server.MapPath("UpLoaded_Files/") + inpfilename; string strConn; strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Exceldb + ";" + "Extended Properties=Excel 8.0;"; //You must use the $ after the object you reference in the spreadsheet OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
DataSet myDataSet = new DataSet(); myCommand.Fill(myDataSet, "ExcelInfo"); GridView1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView; GridView1.DataBind();
try this this will help U a lot
|
| Author: Roshan R Mhatre 02 Jun 2008 | Member Level: Gold Points : 0 |
Importing Excel into SQL using ASP_NET |