Saving data from DataGridView to XML using dataset

Sep 12 2008 7:12 AM
 

Hello people, I've got a problem. Can anybody tell me how can I save data from DataGridView through Dataset to XML? I've found many useful codes that could solve problem like this:

 

Dataset ds = new Dataset();

ds = (Dataset) (DataGridViewXY.Datasource);

ds.WriteXml("XML_name.xml");

 

!but actually! it doesn't work because when I run program it all stops at ds = (Dataset) (DataGridViewXY.Datasource); saying something like cannot assign Dataset to DataGridView...

 

What can I do? Isn't there problem that my DataGridView data are bound? How can I change this property/option?

 

Any hints?

 

Matej


Answers (2)