Using SQL aggregat functions with DataSets / DataViews

R

rancidpunx

Hello!

I have the following problem:

I'm using a DataSet and i want to filter the data!
I know that there exists the DataView, but i only can use the
WHERE-Clause there, for example:

DataView dv = new DataView(myDataSource.Tables[0]);
dv.RowFilter = "id <= 100";

But i have to do more filtering, for example the SQL aggregat functions
like MIN(), MAX(), AVG()...

Is this possible???
 
G

Guest

Try dataTable.Select("sum(f1) from t1");
Description of available funcions are there
http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx
I have the following problem:
I'm using a DataSet and i want to filter the data!
I know that there exists the DataView, but i only can use the
WHERE-Clause there, for example:

DataView dv = new DataView(myDataSource.Tables[0]);
dv.RowFilter = "id <= 100";

But i have to do more filtering, for example the SQL aggregat functions
like MIN(), MAX(), AVG()...

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
V

Volker Hetzer

Hello!

I have the following problem:

I'm using a DataSet and i want to filter the data!
I know that there exists the DataView, but i only can use the
WHERE-Clause there, for example:

DataView dv = new DataView(myDataSource.Tables[0]);
dv.RowFilter = "id <= 100";

But i have to do more filtering, for example the SQL aggregat functions
like MIN(), MAX(), AVG()...

Is this possible???
Why don't you do it in the sql?
Much better for performance.

Lots of Greetings!
Volker
 
G

Guest

When you are working with disconnected dataSet/DataTables (enterprise
applications) additional calls are not the good idea, because in depends on
performance.

You need perform as much as possble with data you have got

Why don't you do it in the sql?
Much better for performance.

Lots of Greetings!
Volker

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

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

Similar Threads

DataViews 1
HELP: DataView does NOT filter :-( 1
Problem with DataView.Sort 2
DataViews with DataSets 4
gridview search issue 8
to open and close or no need to 10
dataGrid confusion 1
sorting gridview question 6

Top