Click to See Complete Forum and Search --> : DataSet To Array in C#


nzhang
06-16-2006, 12:16 PM
I was wondering if any one knew how to grab the items in the DataSet, and store it into a multi-dimensional array?


string dataUrl = "log.xml";
string schemaUrl = "log.xsd";

DataSet ds = new DataSet();
ds.ReadXmlSchema(Server.MapPath(schemaUrl));
ds.ReadXml(Server.MapPath(dataUrl));

DataView dv = new DataView(ds.Tables[0]);
DataTable dt = dv.Table;

AlecW
06-19-2006, 12:29 PM
The question would be why would you want to do this? You could easily pass around a DataTable or DataRow, this would also make it easier for another person to work with if needed.

nzhang
06-19-2006, 02:44 PM
I already figured out how to do it.

I want to be able to hightlight rows with duplicate ID's. I wouldn't know how to do that with DataGrids. If there is an easier way, I wouldn't mind knowing, since I'm a beginner at this.