开发者

Bind DataList with multiple tables in dataset

开发者 https://www.devze.com 2023-03-28 16:42 出处:网络
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 i

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

精彩评论

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

关注公众号