Create Class in C# based on Data Source
Posted on 2006-07-10
I have built a few applications using .NET, but am still learning my way around. I have a SQL database that I want to use in my applicaiton. I have connected and have created datasources pointing to my tables, called HEADER and DETAIL. I want to create classes called HEADER and DETAIL to refer to them in my code, but don't know how to do this. Maybe I am trying hard to do something that is unnecessary, but previously, I manually typed in all the fields to create the class, but I know there is a better way. I can open the dataset designer and see the SQLDataSet.xsd which contains definitions for DETAIL and HEADER.
How can I use this so that in my code I can do something like
DETAIL myDetail = new DETAIL();
HEADER myHeader = new HEADER();
Field1 = HEADER.name;
Field2 = DETAIL.number;
Isn't there an easy way to say build a class based on the data source???