writexmlschema not working

  • Thread starter Thread starter WStoreyII
  • Start date Start date
W

WStoreyII

i have used the following code(which is straight from the msdn) to try this
: how ever this and anyother method that i have tried only give me a

An unhandled exception of type 'System.InvalidCastException' occurred in
system.data.dll

Additional information: Specified cast is not valid.

does anyone have any ideas on what is going wrong?

WStoreyII

Thanks again

Private Sub WriteSchemaWithXmlTextWriter(thisDataSet As DataSet)
' Set the file path and name. Modify this for your purposes.
Dim filename As String = "mySchema.xml"
' Create a FileStream object with the file path and name.
Dim myFileStream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Create a new XmlTextWriter object with the FileStream.
Dim MyXmlTextWriter As New System.Xml.XmlTextWriter _
(myFileStream, System.Text.Encoding.Unicode)
' Write the schema into the DataSet and close the reader.
thisDataSet.WriteXmlSchema(MyXmlTextWriter)
MyXmlTextWriter.Close()
 
Hi WS,

I have seen the sample too, however I that stream does nothing in my
opinion, can you try if this fits you?

Cor
..
Private Sub WriteSchemaWithXmlTextWriter(thisDataSet As DataSet)
thisDataSet.WriteXmlSchema("MyPath")
End Sub
 
that works

but the reason it wasnt working before i figrued out was because i was using
a custom inherited dataset and i guess that i had not programed that code in
so it did not work

but the msdn tutorials a lot of them dont work its like they are made in a
earlier version of vb.net

thanks again for your help

wstorey?
 
Back
Top