Home > Database > Mysql Tutorial > Excel导入数据到SqlServer中提示:定义了过多字段?

Excel导入数据到SqlServer中提示:定义了过多字段?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:33:58
Original
2466 people have browsed it

如题 Excel导入数据到SqlServer中提示:定义了过多字段? 源码: // fileName 文件名 //savePath 路径 DataSet ds = null; try { string myString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + savePath + fileName + ";Extended Properties='Excel

如题   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;

 

求解 ?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template