I added exceldatareader.dll. i download it from
http://exceldatareader.codeplex.com/releases/view/31934[
^]
protected void lnkDispaly_Click(object sender, EventArgs e)
{
string Extension = "";
string FileName = "";
string fileExtension = "";
string fileLocation = "";
if (FuplAssetPath.HasFile)
{
FileName = FuplAssetPath.FileName;
Directory.CreateDirectory(Server.MapPath(".") + "/UploadedExcel/");
FuplAssetPath.PostedFile.SaveAs(Server.MapPath(".") + "/UploadedExcel/" + FileName);
FileName = Path.GetFileName(FuplAssetPath.PostedFile.FileName);
fileExtension = Path.GetExtension(FuplAssetPath.PostedFile.FileName);
fileLocation = Server.MapPath("UploadedExcel/" + FileName);
FuplAssetPath.SaveAs(fileLocation);
//GetExcelSheets(fileLocation, fileExtension, "Yes");
///////////////............
FileStream oStream;
oStream = new FileStream(fileLocation, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
IExcelDataReader iExcelDataReader = null;
FileInfo fileInfo = new FileInfo(FuplAssetPath.PostedFile.FileName);
string file = fileInfo.Name;
//if (file.Split('.')[1].Equals("xls"))
//{
iExcelDataReader = ExcelReaderFactory.CreateBinaryReader(oStream);
iExcelDataReader.IsFirstRowAsColumnNames = true;
DataSet dsUnUpdated = new DataSet();
dsUnUpdated = iExcelDataReader.AsDataSet();
}
}