Excell to Datagrid in asp.net
Hello Friends,
I am retrieving Data from Excell sheet to my Datagrid in ASP.Net Page
The is given below.But It is giving an unspecified error.
Can anyone tell me the sloution.
string connection="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\ExcelData.xls;Extended Properties=Excel 8.0";
string connection="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\Book2.xls";
OleDbConnection con=new OleDbConnection(connection);
OleDbDataAdapter da=new OleDbDataAdapter("select * from [Sheet1$]",con);
DataSet ds=new DataSet();
da.Fill(ds,"XLData");
DataGrid1.DataSource=ds.Tables["XLData"].DefaultView;
DataGrid1.DataBind();
rajkumar sharma
__________________
-------------------
rajkumar sharma
http://www.apnasaathi.blogspot.com
|