Christopher,
All you need to do it to create a typed dataset. This way all of the
code will be autogenerated for you, and not only for the table, but
also nested classes for the table itself and for the table's rows. The
row class, in turn, will expose properties and methods for each of the
columns.
There are 2 similar ways of doing so:
1) Simply create a new dataset, open it in Design mode, and then drag
a table (or as many tables as you want) from the Server Explorer tab
in IDE. You must have a link to the database in the Server Explorer.
2) Design your dataset yourself, by adding elements, attributes of
proper types and relations in the designer.
If you do like shown above, you shouldn't be messinng with XSD
directly. Also do not touch the code behind, because it's re-generated
every time you touch the Designer or XSD.
Typed datasets are very poverful and encapsulate you database tables
and views schema almost completely, down to every column and its
properties.
On Sat, 27 Aug 2005 15:22:17 -0700, "Christopher Weaver"
<we*****@nospamverizon.net> wrote:
Thanks for writing back.
This didn't work for me. But what I found did work was this:
I used the IDE to create a new DataSet with a DataAdapter. I then renamed
the default table "Table" to "Tasks" by editing the xsd definition of the
table schema using the DataSet's local menu choice "View Schema...".
I'm wondering if there isn't some way to rename the table within the
"DataSet Properties..." dialog. It seems like there ought to be.
"Rudderius" <dr***@bestopia.be> wrote in message
news:11***************@seven.kulnet.kuleuven.ac.b e... you have to create the property yourself,
write a class MyDataSet e.g. that inherits from DataSet and just add the
property
e.g.
public DataTable Tasks
{
get { return this.Tables["Tasks"]; }
}
Christopher Weaver schreef: A component that I'm using expects the tables within it to be accessed as
properties (DataSetName.TableName). I have created a DataSet like this:
dsTaskActivities = new DataSet();
odbcDA_TaskActivities.FillSchema(dsTaskActivities, SchemaType.Source,
"Tasks");
My DataAdabpter contains the necessary SQL to retrieve the table,
"Tasks", and the new table ends up in the Tables property of the DataSet
but not as an individual property of the DataSet.
Can anyone tell me how to create the DataTable such that it becomes a
property of the DataSet?