Complex queries on Local data objects?

D

divisortheory

I'm using typed datasets and in my application I, for the most part,
keep local copies of everything in the database in DataTables. So at
any given time my local tables always have at least as much (usually
more) information than the actual database, and occasionally I use the
adapters to Update() the changes back to the database. However,
sometimes I want to access the data in a way which is beyond the scope
of what the generated typed dataset code allows me to do. I can't seem
to find any functions in the DataTable and/or DataSet objects either.
There's the Select() method, but that doesn't let me specify GROUP BY,
JOINs, or other types of more complicated Sql queries. Is there a way
to do this without making a round trip to my database?

If I absolutely must, I can write some code such that every time I need
to execute one of these more complicated queries, all my local
modifications get flushed to disk and then I run the query against the
database, but if possible I'd like to do it on the local
DataSet/DataTable objects.

Thanks
 
O

Otis Mukinfus

I'm using typed datasets and in my application I, for the most part,
keep local copies of everything in the database in DataTables. So at
any given time my local tables always have at least as much (usually
more) information than the actual database, and occasionally I use the
adapters to Update() the changes back to the database. However,
sometimes I want to access the data in a way which is beyond the scope
of what the generated typed dataset code allows me to do. I can't seem
to find any functions in the DataTable and/or DataSet objects either.
There's the Select() method, but that doesn't let me specify GROUP BY,
JOINs, or other types of more complicated Sql queries. Is there a way
to do this without making a round trip to my database?

If I absolutely must, I can write some code such that every time I need
to execute one of these more complicated queries, all my local
modifications get flushed to disk and then I run the query against the
database, but if possible I'd like to do it on the local
DataSet/DataTable objects.

Thanks

When using The IDE to create Data Sources you can write your own queries and
point the wizard at them. The easiest way to do that is to create stored
procedures and specify them when the wizard asks if you want to create or use
existing stored procedures.

Another way to get the queries you want is to add them to the TableAdapters in
the DataSet Designer.

This is all explained in the online documentation.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 

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