convert asp to .NET format question

M

Mike

I'm converting an existing asp application, within the asp app its using 12
SQL queries but showing the results in one table (html). Is there a way to
use these same 12 queries and show the results in one gridview?

Each query is one row of data in the table (current version) So the app is
something like this

Stats jan Feb mar

Monthly Income 12
Monthly Expense 20
Total Monthly Income 32

Quartley Income 350
Quartley Expense 560
Total Quarter Income -210


6 Month Income
6 Month Expense
Total Income for the pass 6 months

and so one, now each row is a seperate query. The 'stat's are hardcoded in
the current asp code and the developer
just created an array for the output and row(0) goes to the monthly income
stat, row(2) goes to the monthly expense and so on.

is there a way to recreate this same output in .NET?
 
K

Kalpesh

Mike,

You could use dataset with each datatable (for 1 query) to fill the
data from the DB.
Each datatable can have its own row collection, which you can get data
from

Alternatively, you could write 1 query, which will do a UNION on all
the query to return all data rows in 1 datatable.

HTH
Kalpesh
 
E

Eliyahu Goldin

For the first idea of running separate queries, the query results will need
to be merged into a single datatable since a gridview or any other databound
control for this matter can bind only to one datasource.

I would suggest creating just one datatable, doesn't matter in a dataset or
not, and populating it with different query results. The queries can be run
with SqlDataReaders.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
M

Mike

I would I do this using 1 datatable, but with multiple queries?
I could merge all 12 queries into one but each query is using a different
where clause due to that web form has 8 drop downs that can be selected and
passed into each query.


Eliyahu Goldin said:
For the first idea of running separate queries, the query results will
need to be merged into a single datatable since a gridview or any other
databound control for this matter can bind only to one datasource.

I would suggest creating just one datatable, doesn't matter in a dataset
or not, and populating it with different query results. The queries can be
run with SqlDataReaders.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Kalpesh said:
Mike,

You could use dataset with each datatable (for 1 query) to fill the
data from the DB.
Each datatable can have its own row collection, which you can get data
from

Alternatively, you could write 1 query, which will do a UNION on all
the query to return all data rows in 1 datatable.

HTH
Kalpesh
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top