uploadfy导入Excel内容到数据库中3
private int ImportSheetData(string userno, string sheet, string bigT, DataTable dt, List<BigTColModel> lstColModel, ref string msg)
{
BigTColModel COL;
/********** 查找列表头对应的列序号 *******/
DataRow drTitle2 = dt.Rows[0];//二级表头
string colName, colName2;
bool bColOver = false;
for (int i = 1; i < dt.Columns.Count; i++)//第0列为序号
{
if (bColOver)
{
break;//最后一列
}
colName = CommonMethod.toString(dt.Columns[i]);
colName2 = CommonMethod.toString( drTitle2[i] );
if (colName == string.Empty && colName2 == string.Empty)
{
continue;
}
for (int k = 0; k < lstColModel.Count; k++)
{
COL = lstColModel[k];
if (colName != COL.sheet_name && colName2 != COL.sheet_name)
{
continue;
}
lstColModel[k].col_pos = i;//记录对应的列索引
if (k == lstColModel.Count - 1)
{
bColOver = true;//最后一列,因为lstColModel是按列大小排序的
}
}
&nb