public DataSet ImportExcel(string strFileName)
{
if (strFileName != "")
{
string conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFileName + ";Extended Properties=Excel 8.0";
string sql = "select * from [Sheet2$]";
OleDbDataAdapter da = new OleDbDataAdapter(sql,conn);
DataSet ds = new DataSet();
try
{
da.Fill(ds, "datatable");
}
catch { }
return ds;
}
else
{
return null;
}
}