excel文件(xls)批量导入sqlserver数据库 用SqlBulkCopy方法批量导入效率高。 string tableName = "TD_GYTDSPF"; string[] fields = { "TDZH", "TDZL", "DLYT", "SYQLX", "FinishTime" }; string connectionString = "server=xxx;User ID=sa;Password=sa;database=xxx;Connection Reset=FALSE"; string connetctonExcel = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\11.xls;Extended Properties=Excel 8.0;"; string filepath = @"e:\11.xlsx"; //把excel作为数据源,读取数据存在dataset中 DB.Database db = Database.GetDatabase(connetctonExcel); DataSet ds; db.ExecuteSQLQuery("SELECT * FROM [sheet1$] ", out ds); /* //建表及清