none
add dataset file to the project with .vb extension RRS feed

  • Question

  • well hi there


    so i have dataset file with the extention *.vb that i manage to recover it from my lost project by using reflector so how i can i add it as dataset to my project
    when i add it using using "add existing item " it appear as normal class and not as dataset

    what to do

    N.B. only .vb file i got abt that dataset nothing else
    the forms i recover it from the .vb file were recovered normally i just have problem with datasets
    I am A Medical Doctor
    Sunday, August 16, 2009 2:51 PM

Answers

  • Okay what we want to do is generate a new DataSet xsd file. In order to do this you need to follow these steps

    1) Take the existing code you have an compile it into a console project
    2) Find the class that derives from DataSet in the code that you attached to the project
    3)Instanciate the class like so

    Dim

     

    dataSet As TypedDataSet = New TypedDataSet()

    replace the name typedDataSet for the name of the typeddataset that is compiled into the program

    Then write code that does the following
    dataSet.WriteXmlSchema("MyDataSet.xsd")

    Execute this program. Then in the bin\debug directory there will be a MyDataSet.xsd file, just add this into your project.

    Thanks
    Chris Robinson
    Program Manager - DataSet


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 17, 2009 8:51 PM

All replies

  • Have you also recovered xsd file as well? Typically this vb file would be created based on an xsd file.

    Thanks
    Chris Robinson
    Program Manager - DataSet
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 17, 2009 4:32 PM
  • as  i said

    just .vb file
    I am A Medical Doctor
    Monday, August 17, 2009 6:04 PM
  • With out the XSD file it will never appear as a DataSet icon.

    As a workaround what you could do is use the typed DataSet class that exists and call set.WriteXmlSchema. This would regenerate an xsd file for that schema. Then you can add this xsd file to your project and you should be able to get back what you had previously. However this will simply regenerate the data layer. This newly generated file my be different from the one that you started with. You would then have to deal with any changes. You might have to migrate over some business logic that is not in the newly generated code file.

    Thanks
    Chris Robinson
    Program Manager - DataSet
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 17, 2009 6:25 PM
  • sorry
    but can u explain it through what to do exactly
    i didnt understand your point
    I am A Medical Doctor
    Monday, August 17, 2009 7:18 PM
  • Okay what we want to do is generate a new DataSet xsd file. In order to do this you need to follow these steps

    1) Take the existing code you have an compile it into a console project
    2) Find the class that derives from DataSet in the code that you attached to the project
    3)Instanciate the class like so

    Dim

     

    dataSet As TypedDataSet = New TypedDataSet()

    replace the name typedDataSet for the name of the typeddataset that is compiled into the program

    Then write code that does the following
    dataSet.WriteXmlSchema("MyDataSet.xsd")

    Execute this program. Then in the bin\debug directory there will be a MyDataSet.xsd file, just add this into your project.

    Thanks
    Chris Robinson
    Program Manager - DataSet


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 17, 2009 8:51 PM
  • I wish I could give you  a couple other solutions but I only see two solutions,

    1) include the code you found and use what it is exactly
    2)Create a new XSD file based on the old one.

    I am going to marked this post as answered, please let me know if you have any further questions or if this solution does not work for you.

    Thanks
    Chris Robinson
    Program Manager


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, August 18, 2009 4:53 PM