DataSetName.TableName

  • Thread starter Thread starter Christopher Weaver
  • Start date Start date
C

Christopher Weaver

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?
 
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:
 
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 said:
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?
 
Back
Top