开发者

Bind DataList with multiple tables in dataset

i have a Datase开发者_如何学Got with 4 tables , i m assigning this Dataset to datalist. i want to bind some fields from all tables in the datalist. Write now its only binding the Table which is on 0 index of dataset, on other table column name its giving exception.

How to bind the datalist with multiple table in dataset.?

Thanks,


You can merge the DataTables that are inside the DataSet and then bind to datalist

 DataTable dtblFinal = new DataTable();

    foreach (DataTable table in dataset.Tables)
    {
        dtblFinal.Merge(table, false, MissingSchemaAction.Add);
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜