Missing properties of typed datasets with multiple tables

R

Rob Richardson

Greetings!

I am trying to use typed datasets intelligently. My first attempt was with
a typed dataset built from a single table of my Access database. After some
assistance from this forum, I was able to get it to work. I tested it on a
database that had a table named Holdings. When I created an instance of my
typed dataset, I found it had all of the properties I'd expect from an
untyped dataset, including a Tables collection, an AcceptChange() method,
and so on. I also found that it had a property named Holdings and subtypes
named HoldingsDataTable, HoldingsRow, and so on. The Holdings property was
of type HoldingsDataTable, and held all of the information from the Holdings
table of my database.

Somebody on this forum pointed out that the dataset object represented the
database, and datatable objects represented tables. So I figured that I
could create a dataset that would contain representations for all three
tables in my database, Holdings, Orders and PortfolioData. It seemed to
work. I was able to create the dataset, use an OleDbDataAdapter's Fill()
method three times, and not throw any exceptions.

But when I tried using an instance of my new dataset object to get
information out of the tables, I was surprised to see that I didn't have any
properties or methods in my dataset object. All I had were the subtypes for
each of my tables! I was expecting my dataset to have properties named
Holdings, Orders and PortfolioData, and all of the methods a dataset object
would have. Why didn't it? Did I do something wrong? Can't I have
multiple tables described in a single dataset object or .xsd file?

Thanks very much!

Rob
 
M

Miha Markic

Hi Rob,

Rob Richardson said:
Greetings!

I am trying to use typed datasets intelligently. My first attempt was with
a typed dataset built from a single table of my Access database. After some
assistance from this forum, I was able to get it to work. I tested it on a
database that had a table named Holdings. When I created an instance of my
typed dataset, I found it had all of the properties I'd expect from an
untyped dataset, including a Tables collection, an AcceptChange() method,
and so on. I also found that it had a property named Holdings and subtypes
named HoldingsDataTable, HoldingsRow, and so on. The Holdings property was
of type HoldingsDataTable, and held all of the information from the Holdings
table of my database.

Sure, it is derived from DataSet.
Somebody on this forum pointed out that the dataset object represented the
database, and datatable objects represented tables. So I figured that I
could create a dataset that would contain representations for all three
tables in my database, Holdings, Orders and PortfolioData. It seemed to
work. I was able to create the dataset, use an OleDbDataAdapter's Fill()
method three times, and not throw any exceptions.

Good :)
But when I tried using an instance of my new dataset object to get
information out of the tables, I was surprised to see that I didn't have any
properties or methods in my dataset object. All I had were the subtypes for
each of my tables! I was expecting my dataset to have properties named
Holdings, Orders and PortfolioData, and all of the methods a dataset object
would have. Why didn't it? Did I do something wrong? Can't I have
multiple tables described in a single dataset object or .xsd file?

Yes, you can - that's the point of datasets.
Maybe your intellisense wasn't functioning for some reason.
You might try to type the properties you expect and try to compile and see
if it works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top