Re: Create DataSet programmatically, as object by Brian
Brian
Thu Feb 05 20:19:26 CST 2004
Hi Andre,
I think what you are thinking of is a typed data set. To create a typed data
set, you need an XML schema representing the data you want to create it
from. You can either create the XML Schema from hand, or you can get it by
dragging a SQL Server table into the XSD schema designer in Visual Studio
.NET from Server Explorer.
Once you have an XSD schema open in Visual Studio, just right click in the
designer and select the Generate DataSet menu item. Either that or use the
xsd.exe tool to create a typed data set.
What results is a class derived from DataSet that contains strongly typed
properties and nested classes for the rows and tables, and if you have
relationships in the XSD schema, those will result in data relations.
Hope that helps get you pointed in the right direction.
Brian
"Andre Ranieri" <anonymous@discussions.microsoft.com> wrote in message
news:06B340D0-0287-4E04-B116-D30C8D412145@microsoft.com...
> I've seen code snippets where ADO.NET datasets are created
programmatically as their own class, which inherits from
System.Data.DataSet. The code usually resembles, the following with tables,
relationships and constraints created in the user defined class.
>
> class DataSet : System.Data.DataSet
> {
> }
>
> I've been searching for documentation on how to do this and what the
requirements are for constructors and methods. Also, what are the practical
applications for creating a dataset programmatically this way, beyond having
full controll over the object. However, I haven't been very successful in
finding information.
>
> I would appreciate any links to reference material that anyone could send
my way. Thanks in advance!
>
>