In the previous article, you way saw how you can generate DataSet objects from a data adapter. There are other ways to create a typed DataSet object.
You can click on the project menu and choose Add New Item (or click Ctrl +D). This brings up the Add New Item window where you'll find the Data Set template (see figure 4-50).
Figure 4-50. Creating a typed Dataset from the Add New Item window
After adding the DataSet, the designer creates an XSD (XML schema) file and adds it to your project area. As you can see from figure 4-51, myDS.xsd is empty.
Figure 4-51. myDS.xsd in VS.NET
Next drop a table (or multiple tables) from the server Explorer to the form (see figure 4-52).
Figure 4-52. Drag and drop tables from the server Explorer to the from to create a typed Dataset
This action adds one XML schema (MyDS.xsd), which looks like figure 4-53.
Figure 4-53. Design View of the XML schema of the Dataset
It also automatically adds the typed DataSet class that inherits from DataSet. As you can see in figure 4-54, the myDS class contains members used to access data from the database.
Figure 4-54. Wrapper class generated for the typed DataSet
Once you have this class, you can create an instance of this class and work with its property fields directly:
Dim ds As New MyDSet() Conclusion
Hope this article would have helped you in understanding Adding Typed DataSets in ADO.NET. See my other articles on the website on ADO.NET.