473,414 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

DataSetName.TableName

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?
Nov 17 '05 #1
3 1626
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?

Nov 17 '05 #2
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.be ...
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?

Nov 17 '05 #3
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?

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Liam3 | last post by:
I'm having a problem with a table that accidently had a column added whose type is the same as the table. This is seriously creating a problem as I cannot delete the table and I really don't have...
2
by: Christian Höhener | last post by:
Hi I have a given attributvalue of a specific attribut (sys_obid=81653) which occurs in multiple tables. Now, I should know the tablename of the table in which this attribut occurs. Which...
1
by: N E | last post by:
hello I am trying to do a procedure that : 1 - Take a table name, a field name and a value as parameter 2 - check if the fieldname=value in the tablename table 3 - returns 1 if so, 0 if not ...
3
by: Antonio Ooi | last post by:
Hi, I get a DataTable based on this simple query: SELECT * FROM Customers Later, I want to know just the table name because I do not want to play with the string within the SELECT statement....
1
by: Kruno Milicevic | last post by:
I want to fill DataGrid with some table from my database. I usual use something like this: string sqlString ="SELECT * FROM TableName"; OleDbCommand myOleDbCommand = new OleDbCommand(sqlString ,...
3
by: Dag-Erling Smørgrav | last post by:
The PL/PGSQL documentation contains at least two examples of functions which take an argument of type "tablename", which then serves as a table name in a query. Here's one of those examples: >...
4
by: Ying Lu | last post by:
Hello, Under mysql, we have "desc tablename" to get the detail information about a table. My question is about to get column name, and column type for a specific table under PostgreSQL through...
3
by: JF | last post by:
I would like to automate a Union query going through the tables of my dataset using VBA: I have this code: ------------------------------------------------------------------- Sub ssql() Dim...
2
by: Adrien Reboisson | last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I installed SQL Server 2005 Express, created a blank project, dropped a TreeView, a ListView and a DataGridView : DB objects...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.