ここに私がこれまでに持っているコードがあります。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]
。
誰かがこのことを整理するのを手伝ってくれて、何が悪いのか教えてくれませんか? ありがとう