public DataSet ImportFromExcel(string file_path)
{
if(file_path == "")
{
return null;
} connection = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + file_path + ";" +
"Extended Properties=Excel 12.0";
OleDbDataAdapter excel_data = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connection); DataSet excel_ds = new DataSet(); try
{
excel_data.Fill(excel_ds);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return null;
} return excel_ds;
}
这是我的导入方法,XP\win2007\win2003 都是可以的,但是到了vista中就出错了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货