#region 批量导入数据
/* */
string xllPath = @"E:\CH\通用导入工具";
string tableName = "HCYSJ";
CpmVars myVar = new CpmVars(tableName, xllPath);
Excel.Application app = new Excel.Application();
app.Visible = true;
Excel.Workbook wb = null;
string path = @"E:\CH\红冲\data";
List<string> strs = new List<string>();
string[] files = EUtil.RetrieveFilesFromDir(path);
int count = 0;
foreach (var item in files)
{
string fileName = path + "\\" + item;
//strs.Add(fileName);
wb = app.Workbooks.Open(Filename: fileName, ReadOnly: true);
foreach (Excel.Worksheet sht in wb.Worksheets)
{
count += EUtil.ImportData(sht, myVar, tableName);
}
wb.Close();
}
app.Quit();
string msg = string.Join(Environment.NewLine, strs.ToArray()) + count.ToString();
MessageBox.Show(msg);
#endregion