string excelFileName = StartConstructionPlanFacade.GetExcelFirstTableName(filePath);
GetConnectionObject.InitConnectionObject("Excel");
cn = GetConnectionObject.ExceoConnectionObject;
string sql = "select distinct [单价分析综合表] from [" + excelFileName + "] where [单价分析综合表] is not null"
+ " and F2 not in ('人工','材料','机械',null) and F3 is null";
OdbcCommand cmd = cn.CreateCommand();
cmd.CommandText = sql;
da = new OdbcDataAdapter(cmd);
cn.Open();
da.Fill(ds, "quotaIDTable");
data = ds.Tables["quotaIDTable"];
int k = 0;
while (new BudgetQuotaQuery().GetBudgetQuotaInfo
(ds.Tables["quotaIDTable"].Rows[k]["单价分析综合表"].ToString()).Rows.Count == 1
|| k < ds.Tables["quotaIDTable"].Rows.Count - 1)
{
for (int i = 0; i < ds.Tables["quotaIDTable"].Rows.Count; i++)
{
if (new BudgetQuotaQuery().GetBudgetQuotaInfo
(ds.Tables["quotaIDTable"].Rows[i]["单价分析综合表"].ToString()).Rows.Count == 1)
{
ds.Tables["quotaIDTable"].Rows.RemoveAt(i);
}
}
k++;
}
}
catch (Exception er)
{
throw er;
}
finally
{
GetConnectionObject.CloseExcelConnectionObject(cn);
}
return ds;
GetConnectionObject.InitConnectionObject("Excel");
cn = GetConnectionObject.ExceoConnectionObject;
string sql = "select distinct [单价分析综合表] from [" + excelFileName + "] where [单价分析综合表] is not null"
+ " and F2 not in ('人工','材料','机械',null) and F3 is null";
OdbcCommand cmd = cn.CreateCommand();
cmd.CommandText = sql;
da = new OdbcDataAdapter(cmd);
cn.Open();
da.Fill(ds, "quotaIDTable");
data = ds.Tables["quotaIDTable"];
int k = 0;
while (new BudgetQuotaQuery().GetBudgetQuotaInfo
(ds.Tables["quotaIDTable"].Rows[k]["单价分析综合表"].ToString()).Rows.Count == 1
|| k < ds.Tables["quotaIDTable"].Rows.Count - 1)
{
for (int i = 0; i < ds.Tables["quotaIDTable"].Rows.Count; i++)
{
if (new BudgetQuotaQuery().GetBudgetQuotaInfo
(ds.Tables["quotaIDTable"].Rows[i]["单价分析综合表"].ToString()).Rows.Count == 1)
{
ds.Tables["quotaIDTable"].Rows.RemoveAt(i);
}
}
k++;
}
}
catch (Exception er)
{
throw er;
}
finally
{
GetConnectionObject.CloseExcelConnectionObject(cn);
}
return ds;
GetConnectionObject.InitConnectionObject("Excel");
cn = GetConnectionObject.ExceoConnectionObject;
这一段参数不组,你用什么做数据库啊!如果用excel的话,直接做为数据库连接算了,搞那么复杂!