dataview rowfilter in Loop
DataTable Table = new DataTable();
DataRow row;
try
{
row = Value.NewRow();
for (int i = 0; i < Value.Rows.Count; i++)
{
TableNm = new DataView(DB.Tables[1]);
TableNm.RowFilter = "name = " + "'" +""+Value.Rows[i][0].ToString()+"" + "'" + "";
row[i] = (TableNm.ToTable()).Rows;
}开发者_如何学Python
Table.Rows.Add(row);
For The Above I am Trying to Filter Multiple value and Bind or add row in data table But it's not working any suggestion for dataview rowfilter in for loop where every Rowfilter return only one row every time
It's a real problem you can add Dynamically column first than try row.add(row item arry) instant of row.add()
just like
DataTable Table = new DataTable();
DataRow row;
try
{
//Add column here
row = Value.NewRow();
for (int i = 0; i < Value.Rows.Count; i++)
{
TableNm = new DataView(DB.Tables[1]);
TableNm.RowFilter = "name = " + "'" +""+Value.Rows[i][0].ToString()+"" + "'" + "";
row[i] = (TableNm.ToTable()).Rows;
}
Table.Rows.Add(row.ItemArray);
精彩评论