visual studio - xml and strongly-typed datasets with the dataset designer -


I do not believe it is possible but here is what I want to do: Using the dataset designer in Visual Studio, StrTypDS I have also created a blank XML file and added it to my project as a resource so that it can be accessed through properties. Resource.xmlData I would like to read the xml file and see if any data matches the dataset of my strongly typed dataset. If the data is matchable, then I want to read it in the dataset so that I can process it. If the data does not match, then I want to write the schema in the XML file so that I can store the data typed in the future to be read in future. What is the easiest way to do this?

You can not write a resource, because the resource file has been compiled in the assembly.

To try to read xml files in your strongly typed dataset, use this example (VB.NET) ...

I have created two typed datasets With the DS1 and DS2 different schemas, I write two sample XML data files without their schema. I then try to read every XML file in an XML folder that matches my goal, which corresponds to my goal. After trying to read my target dataset, if there is data in it, then the schema was a match

  in the form of Private InputFolder string = "C: \ xmlinputdata \". Personal Sub Form1_Load (ByVal), as the object, byVal E. System.EventArgs Handle Me.Load WriteTestXML () for each IO.Directory.GetFiles (InputFolder, "* .xml") Dim dsTarget New DS1 dsTarget .ReadXml (Data.XmlReadMode.IgnoreSchema) as if DatasetHasData (dsTarget) then MsgBox (dsTarget.GetXml) end then the next End Sub Private Function DatasetHasData (as ByVal DS Data.DataSet) as Boolean Data Dt.Rows.Count & gt; then Ds.Tables for DT each as DataTable; 0 return return true end then next return false expiration function x.dt1.Adddt1Row ('C', 'D') as private sub WriteTestXML () dim x new DS1 x.dt1.Adddt1Row ('A', 'B') ) X .WriteXml (InputFolder & amp; "ds1.xml", Data.XmlWriteMode.IgnoreSchema) Dim and y.dt2 .Adddt2Row as new DS2 (1, 2, 3) .Adddt2Row (4, 5, 6) ) End with y.WriteXml (InputFolder and "ds2.xml", Data.XmlWriteMode.IgnoreSchema) End Sub  

Comments