Create an empty datatable

  • Thread starter Thread starter QuiQ quiq via .NET 247
  • Start date Start date
Q

QuiQ quiq via .NET 247

Hello,

I'm a .net (CF) newbie, and I have the followong problem:

I try to create an application in .NET CF using data stored inXML/XSD files for an iPAQ.
When I load an XSD file into a dataset i want to create an epmtytable which structure was described in the xsd file. The onlysolution I have found is to load a "dummy" xml file with atleast one record that match the table's structure and then call the "Clear" method for the table, but it's not verycomfortable...

thanks for any replies in advance
 
Hi QuiQ,

I am not sure if this works on CF of however normaly you can write an empty
dataset with
ds.WriteXml("mypath", XmlWriteMode.WriteSchema)

and than read it back with
ds.ReadXml("mypath")

You can try that?

Cor
 
QuiQ:


Hello,

I'm a .net (CF) newbie, and I have the followong problem:

I try to create an application in .NET CF using data stored in XML/XSD
files for an iPAQ.
When I load an XSD file into a dataset i want to create an epmty table which
structure was described in the xsd file.
<<I'm not sure how you are doing this, but you definitely don't have to do
anything fancy.>>
The only solution I have found is to load a "dummy" xml file with at least
one record that match the table's structure and then call the "Clear"
method for the table, but it's not very comfortable...
<<I"m not sure what method that's using but it sounds awkward. What are you
using to load the XSD? Note that Strongly Typed Datasets as they are known
in the full framework don't exist in the cf yet, but that doesn't really
limit you too much. First, create the .xsd file in VS.NET

Next create a file reference to it:
fileXSD = "\program files\YourProgram\NameMatchingXMLFile.xsd"

Next create a stream and read in the .xsd
Dim xsdStrreamReader As New FileStream(fileXSD, FileMode.Open)

Dim xmlSchemaReader as New XmlTextReader(xsdStreamReader)

now just use your dataset and readXMLSchema

myDataSet.ReadXmlSchema(xmlSchemaReader)

Other than the obvios file open io try catch stuff and closing the streams,
that'll get you your schema.

Let me know if you have any problems.

Bill




thanks for any replies in advance
 
Back
Top