开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜