writexmlschema not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WStoreyII

    writexmlschema not working

    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.Invalid CastException' 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 WriteSchemaWith XmlTextWriter(t hisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "mySchema.x ml"
    ' Create a FileStream object with the file path and name.
    Dim myFileStream As New System.IO.FileS tream _
    (filename, System.IO.FileM ode.Create)
    ' Create a new XmlTextWriter object with the FileStream.
    Dim MyXmlTextWriter As New System.Xml.XmlT extWriter _
    (myFileStream, System.Text.Enc oding.Unicode)
    ' Write the schema into the DataSet and close the reader.
    thisDataSet.Wri teXmlSchema(MyX mlTextWriter)
    MyXmlTextWriter .Close()


  • Cor Ligthert

    #2
    Re: writexmlschema not working

    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 WriteSchemaWith XmlTextWriter(t hisDataSet As DataSet)
    thisDataSet.Wri teXmlSchema("My Path")
    End Sub


    Comment

    • Cor Ligthert

      #3
      Re: writexmlschema not working

      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 WriteSchemaWith XmlTextWriter(t hisDataSet As DataSet)
      thisDataSet.Wri teXmlSchema("My Path")
      End Sub


      Comment

      • WStoreyII

        #4
        Re: writexmlschema not working

        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?

        "Cor Ligthert" <non@planet.n l> wrote in message
        news:uY4KDGTHEH A.3820@tk2msftn gp13.phx.gbl...[color=blue]
        > 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 WriteSchemaWith XmlTextWriter(t hisDataSet As DataSet)
        > thisDataSet.Wri teXmlSchema("My Path")
        > End Sub
        >
        >[/color]


        Comment

        • WStoreyII

          #5
          Re: writexmlschema not working

          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?

          "Cor Ligthert" <non@planet.n l> wrote in message
          news:uY4KDGTHEH A.3820@tk2msftn gp13.phx.gbl...[color=blue]
          > 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 WriteSchemaWith XmlTextWriter(t hisDataSet As DataSet)
          > thisDataSet.Wri teXmlSchema("My Path")
          > End Sub
          >
          >[/color]


          Comment

          Working...