如题 Excel导入数据到SqlServer中提示:定义了过多字段?
源码:
// fileName 文件名
//savePath 路径
DataSet ds = null;
try
{
string myString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + savePath + fileName + ";Extended Properties='Excel 8.0;HDR=No;IMEX=1'";
OleDbConnection oconn = new OleDbConnection(myString);
oconn.Open();
ds = new DataSet();
OleDbDataAdapter oda = new OleDbDataAdapter("select * from [Sheet1$]", oconn);
oda.Fill(ds);
oconn.Close();
}
catch (Exception ea)
{
My.ClientScript.Alert(this, "提供的文档错误:" + ea.Message);
}
return ds;
犯罪嫌疑人X
摇曳的蔷薇