c# - Reading from XML file into a DataSet -


I try to fill a DataSet with the value from an XML file like this So that I can fill again with a DataGridView :

  dataset DS = new dataset (); ;: Ds.ReadXml ("\ aaa.xml c" @) DataGridView1.DataSource = DS; DataGridView1.DataSource = "Products";   

But I did not find anything. Are you wrong

Are you sure your loaded data will be called product In your data set ??

After verifying the data, try verifying by examining the table in the dataset:

  DataSet ds = new DataSet (); DS ;: ReadXml ("\ aaa.xml c" @) Foreach (DataTable in ds.Tables) {string tableName = t.TableName; // Apply a breakpoint here - Inspect table names)   

If you just want to keep the first table shown, try this snippet:

  DataSet DS = new dataset (); DS ;: ReadXml ("\ aaa.xmlc" @) DataGridView1.DataSource = DS; DataGridView1.databar = DTTables [0] .tablename;    

Comments