1

这是我到目前为止的代码。comm是一个字符串数组,ds是一个数据集类型变量。

comm = new string[flist.Count()];

SqlDataAdapter adapter = new SqlDataAdapter();

for (int i = 0; i <= flist.Count() - 1; i++)
{
    comm[i] = "select tblcustodians.name as Custodian,count(*) as Nondupe, dupstatus from tbldoc join tblcustodians on tbldoc.custodianid = tblcustodians.id where path like '" + flist[i] + "%' group by tblcustodians.name, dupstatus order by custodian ASC";

    mycomm.CommandText = comm[i];

    adapter.SelectCommand = mycomm;

    adapter.Fill(ds);
}

我正在尝试构建一个循环,因此CommandText它将随着循环而变化,最终数据集将填充每个 comm 数组生成的数据表,但这段代码只给了我一个带有 1 个数据表的数据集,由comm[0].

谁能帮我解决这个问题,并告诉我出了什么问题?谢谢

4

0 回答 0