Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
945
How to Export UltraWinGrid to a Dataset
posted

I have an issue where i wanted to export the content of a ultraWinGrid to a Datset. So far things were going fine as i was cloning the Datasource to get a dataset structure and then adding the records that were visible.

However the user has now added some calculated fields to the grid that do not appear in the underlyinng datasource. Is there any  sample code awaile to dump the contents of a grid to a dataset. 

Obviously the other option is that i write some a loop to go through all the visible columns to create a dataset structure and in turn write a loop to iterate through the record and add then to the dataset

Thanks in Advance,

Ray

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    donor said:
    Obviously the other option is that i write some a loop to go through all the visible columns to create a dataset structure and in turn write a loop to iterate through the record and add then to the dataset

    Yes, that's correct, you can iterate the Columns collection of the first band, and add a DataColumn for each one of them to a DataTable's Columns collection. Then you can iterate the control's Rows collection, and add a DataRow for each one of them to the DataTable's Rows collection. You can get the cell values via UltraGridRow.Cells[n].Value, and assign that to DataRow[DataColumn].

    Note that if you are dealing with a hierarchical DataSet, there is more to it as you would have to get the child rows off each parent, and add them to another table, and then derive the relationship between the bands to create a DataRelation.

Children
No Data