help with data set

Hi

I have made a data set from a xml file with no problem. However how do you bind the dataset to a data grid

Thank you



Answer this question

help with data set

  • TomChung

    Thank you for your help i am a first time user at this. I really like it!
  • Manidkn

    ok here is the code i put together

    foreach (DataTable dt in ds.Tables)

    {

    XMLDATA_dataGridView.DataMember = dt.TableName;

    }

    XMLDATA_dataGridView.Show();

    the porblem is when it pops up (data viewer) it shows no data. What am i missing Also i do have data in my data set so that is ok

    cisco


  • MattMorg

    You can set the DataSource property of the DataGrid. with you DataSet or a DataTable from you DataSet.

    When you set the whole DataSet, you can specify the table to display in the DataMember property.

    A great article about DataBindings can be found here: Data Binding in .NET / C# Windows Forms.


    myDataGrid.DataSource = myDataTable;



  • NJCLC

    DataGrid1.DataSource = yourDataSet;

    DataGrid1.DataMember = "yourTableName";


  • Sudeep Ghosh

    Have you set the DataSource


  • Lars Kjeldsen

    DataMember property can only remember one assignment, since you are assigning a value in a for loop, it is going to remember only the last table name from your data set collection.

    Are you building a WinForms app or Web app Are you using .NET 1.1 or .NET 2.0 If you are using GridView in .NET 2.0 (at least you named your control as GridView) it can only show one table.

    Can you post the code where you load XML into dataset


  • help with data set