OleDbException (0x80004005): 未指定的错误
我的代码如下,在本机调试没有问题的,但是不知道为啥一发布到服务器就出现这样的错误
if (fileUp.HasFile)
{
string _FileName = fileUp.PostedFile.FileName;
string _Name = fileUp.FileName;
//OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\test.xls;Persist Security Info=False;Extended Properties=Excel 8.0;");
string _Filepath = Server.MapPath("ExeclFile") + "\\" + _Name;
fileUp.PostedFile.SaveAs(_Filepath);
string _text = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _Filepath + ";Persist Security Info=False;Extended Properties=Excel 8.0;Network Library =dbmssocn;";
OleDbConnection Con = new OleDbConnection(_text);
Con.Open();
OleDbCommand Cmd = new OleDbCommand("Select * From [Sheet1$]", Con);
OleDbDataAdapter Da = new OleDbDataAdapter();
Da.SelectCommand = Cmd;
DataTable _Dt = new DataTable();
Da.Fill(_Dt);
Con.Close();
//然后是插入到数据库的代码
}