Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / January 2008

Tip: Looking for answers? Try searching our database.

convert asp to .NET format question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 31 Jan 2008 01:26 GMT
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?
Kalpesh - 31 Jan 2008 06:06 GMT
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
Eliyahu Goldin - 31 Jan 2008 09:18 GMT
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.

Signature

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

> Mike,
>
[quoted text clipped - 8 lines]
> HTH
> Kalpesh
Mike - 31 Jan 2008 12:35 GMT
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.

> 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
[quoted text clipped - 16 lines]
>> HTH
>> Kalpesh

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.