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はループとともに変化し、最終的にデータセットは各通信配列によって生成されたデータテーブルで満たされますが、このコードは によってクエリされる 1 つのデータテーブルを持つデータセットのみを提供しますcomm[0]

誰かがこのことを整理するのを手伝ってくれて、何が悪いのか教えてくれませんか? ありがとう

4

0 に答える 0