最近项目用到的读取Excel 为DataTable 兼容2003.2007.2010.记录一下,以后会用到 引用 NPOI.dll 和 EPPlus.dll using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using OfficeOpenXml; using System.IO; using NPOI.SS.UserModel; usi…
第一次写C#与sql的东西,主要任务是从Excel读取数据,再存到SQL server中. 先上读取Excel文件的code如下. public bool GetFiles(string equipName) { //choose all sheet? or all data in sheet? string strExcel = "select * from [Sheet1$]"; //初始化system.IO的配置(路径) DirectoryInfo directoryInfo1…
using System; using System.Data; using System.Data.OleDb; using System.IO; using System.Linq; using System.Text; namespace DaliyTest { public class ExcelToDataTable : IWork { public void Work() { var path = AppDomain.CurrentDomain.BaseDirectory + "读取…