|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
populate many xml file into single datasethaving different table names. I found most of example showing the 'fill' method in dataadapter but no xml file. I will finally create the relationship for joining two tables togeter. Can anyone here help me to modify the code to allow to read the second xml file to the dataset? Thanks, Naruphon using System; using System.IO; using System.Data; class TestXML{ public static void Main(){ StreamReader rd = File.OpenText("Project.xml"); DataSet ds = new DataSet("Project"); ds.ReadXml(rd); rd.Close(); // I need to load the job.xml here. foreach(DataRow drProject in ds.Tables["Project"].Rows) { Console.WriteLine("{0}{1}",drProject["id"],drProject["Name"]); } } } Naruphon,
What is it you want to do, to add a datatable into another dataset is just to remove it from the first and add it to the other, is that what you want to do? Cor Show quote "naruphon" <narup***@hotmail.com> schreef in bericht news:OAWbGQTcGHA.4892@TK2MSFTNGP02.phx.gbl... >I wanted to read two differrent xml files and put into the same dataset but >having different table names. I found most of example showing the 'fill' >method in dataadapter but no xml file. I will finally create the >relationship for joining two tables togeter. Can anyone here help me to >modify the code to allow to read the second xml file to the dataset? > > Thanks, > Naruphon > > using System; > > using System.IO; > > using System.Data; > > class TestXML{ > > public static void Main(){ > > > StreamReader rd = File.OpenText("Project.xml"); > > DataSet ds = new DataSet("Project"); > > ds.ReadXml(rd); > > rd.Close(); > > > // I need to load the job.xml here. > > foreach(DataRow drProject in ds.Tables["Project"].Rows) > > { > > Console.WriteLine("{0}{1}",drProject["id"],drProject["Name"]); > > } > > > > } > > > } > > |
|||||||||||||||||||||||