convert asp to .NET format question
convert asp to .NET format question
am 31.01.2008 02:26:05 von 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?
Re: convert asp to .NET format question
am 31.01.2008 07:06:08 von shahkalpesh
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
Re: convert asp to .NET format question
am 31.01.2008 10:18:25 von 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
"Kalpesh" wrote in message
news:16531e62-9af6-4a28-bb02-f248a8b0f8b5@m34g2000hsf.google groups.com...
> 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
>
Re: convert asp to .NET format question
am 31.01.2008 13:35:19 von 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" wrote in
message news:u4LGap%23YIHA.3880@TK2MSFTNGP05.phx.gbl...
> 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" wrote in message
> news:16531e62-9af6-4a28-bb02-f248a8b0f8b5@m34g2000hsf.google groups.com...
>> 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
>>
>
>