简体   繁体   English

将 DataList 与数据集中的多个表绑定

[英]Bind DataList with multiple tables in dataset

i have a Dataset with 4 tables, im assigning this Dataset to datalist.我有一个包含 4 个表的数据集,我将此数据集分配给数据列表。 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.现在写它唯一绑定在数据集的0索引上的表,在其他表列名上它给出异常。

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您可以merge DataSet内的DataTables ,然后绑定到datalist

 DataTable dtblFinal = new DataTable();

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM