query DataSet

D

DG

I have a copy of DB in my dataset (just rows that i need ofcourse).
I'd like to create a view. (connectiong tables via Foreign Keys, and getting
columns that i want)
Is there a way to query dataset, or should i go to database for that.
(i was hoping to save myself trip to DB, cause all datata needed is in
DataSet)

Thanx.
 
W

W.G. Ryan - MVP

If you are looking for a view in the sense of combining the columns of two
different datatables, then there's not a simple object to handle it per se.
The DataView object is based on one table at a time so it can't be used. But
you can either loop through your existing rows in your dataset and build a
new datatable, or query your view directly from the db, which will give you
a local datatable that has the same schema and data as your db's view.

Is this what you were asking?
 
D

DG

i had doubts what to do, to loop through rows, to go to DB again, or is
there a better way.
I must say in my case verdict goes to another trip tp DB, cause i have 3
tables and looping join would bee too expensive.

Thanx.
 
C

Cor Ligthert [MVP]

DG,
I must say in my case verdict goes to another trip tp DB, cause i have 3
tables and looping join would bee too expensive.
I am always curious what expensive means in this, the framework is full of
loops behind the scene, so it cannot be the processing time?

Cor
 
A

Adrian Moore

DG,

You might be interested in the assembly I've been working on at
http://www.queryadataset.com. Besides INNER JOINS, it lets you perform
complex SQL SELECT statements including UNION, OUTER JOINS, GROUP BY,
HAVING, ORDER BY, sub-queries, etc against the tables in a dataset. The
result of a query is a non-updatable DataView.

Adrian Moore
http://www.queryadataset.com
 
W

W.G. Ryan - MVP

DG said:
i had doubts what to do, to loop through rows, to go to DB again, or is
there a better way.
I must say in my case verdict goes to another trip tp DB, cause i have 3
tables and looping join would bee too expensive.
DG- there's obviously going to be quite a few factors that influence this,
but a round trip across the network to a database, to pull data that will be
redundant since you're joining on the db - If performance is your main
priority, I'm not sure hitting the db is *necessarily* the way to go. And
if you loop, there's less possibility of General Network errors/
Connection/Command Timeouts etc.

Definitely not trying to be argumentative on this end - just figured I'd
point it out to be safe ;-)
 

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