473,657 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Datasets to one Datagrid

Can anyone help me????

I have a table that I need to get the sum of four individual fields and then
rank them from highest to lowest total. After summing up the four fields
individually and ranking them, I have to place them in a single datagrid.

Example:
Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by
rep (not my table!!!)

SQL Statement: Select sum(Revenue), Sum(Quantity), Sum(CreditApps) ,
Sum(Accounts).. .

Rank each column individual from highest Revenue to Lowest, from highest
quantity to lowest etc...

My solution was to query the tables four time (1 for each field) hence
creating four datasets. I then have a sub routine that adds a field titled
Rank to each dataset and adds the sequence number for the ranking.

NOW, I have to join the four tables but not as parent - child but as
additional fields for the same table

Outcome: Total Revenue, Ranking, Total Quantity, Ranking, Total Credit
Apps, Ranking, Total Accounts Ranking...

HOW DO I DO THAT???? HELP???

Deadline looming near!!!

Thanks,
Julio
Jul 21 '05 #1
3 2571
Julio, you can use a DataRelation and an expression column to do
this...Expressi on Columns support SUM which looks like the only aggregate
you need (they support a bunch of other ones, but that's irrelevant) You'll
can use a DataRelation which will allow you to get the Group By
Functionality http://www.knowdotnet.com/articles/datarelation.html. This is
important b/c if you only have one table and you use SUM(Price) for instance
as the expression every row will have the same value in its SUM(Price)
column
"Julio Sarmiento" <jl*****@bellso uth.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Can anyone help me????

I have a table that I need to get the sum of four individual fields and then rank them from highest to lowest total. After summing up the four fields
individually and ranking them, I have to place them in a single datagrid.

Example:
Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by
rep (not my table!!!)

SQL Statement: Select sum(Revenue), Sum(Quantity), Sum(CreditApps) ,
Sum(Accounts).. .

Rank each column individual from highest Revenue to Lowest, from highest quantity to lowest etc...

My solution was to query the tables four time (1 for each field) hence
creating four datasets. I then have a sub routine that adds a field titled Rank to each dataset and adds the sequence number for the ranking.

NOW, I have to join the four tables but not as parent - child but as
additional fields for the same table

Outcome: Total Revenue, Ranking, Total Quantity, Ranking, Total Credit
Apps, Ranking, Total Accounts Ranking...

HOW DO I DO THAT???? HELP???

Deadline looming near!!!

Thanks,
Julio

Jul 21 '05 #2
Ryan, thanks for the input and link. I am going to read your article to
learn more about it.Hopefully, it will help. If not, you will be hearing
(reading) from me again...

Thanks!
"William Ryan" <do********@nos pam.comcast.net > wrote in message
news:ee******** ******@TK2MSFTN GP12.phx.gbl...
Julio, you can use a DataRelation and an expression column to do
this...Expressi on Columns support SUM which looks like the only aggregate
you need (they support a bunch of other ones, but that's irrelevant) You'll can use a DataRelation which will allow you to get the Group By
Functionality http://www.knowdotnet.com/articles/datarelation.html. This is important b/c if you only have one table and you use SUM(Price) for instance as the expression every row will have the same value in its SUM(Price)
column
"Julio Sarmiento" <jl*****@bellso uth.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Can anyone help me????

I have a table that I need to get the sum of four individual fields and

then
rank them from highest to lowest total. After summing up the four fields individually and ranking them, I have to place them in a single datagrid.
Example:
Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by rep (not my table!!!)

SQL Statement: Select sum(Revenue), Sum(Quantity), Sum(CreditApps) ,
Sum(Accounts).. .

Rank each column individual from highest Revenue to Lowest, from

highest
quantity to lowest etc...

My solution was to query the tables four time (1 for each field) hence
creating four datasets. I then have a sub routine that adds a field

titled
Rank to each dataset and adds the sequence number for the ranking.

NOW, I have to join the four tables but not as parent - child but as
additional fields for the same table

Outcome: Total Revenue, Ranking, Total Quantity, Ranking, Total Credit
Apps, Ranking, Total Accounts Ranking...

HOW DO I DO THAT???? HELP???

Deadline looming near!!!

Thanks,
Julio


Jul 21 '05 #3
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

'Put user code to initialize the page here

Dim cnn As New SqlConnection(" data source=test;use r id=sa;initial
catalog=test")

Dim da As SqlDataAdapter

Dim strSQL As String

Dim ds As New DataSet()

strSQL = "select id, quantitysold from testRelations"

da = New SqlDataAdapter( strSQL, cnn)

da.Fill(ds, "quantity")

cnn.Open()

strSQL = "select id, dollarsSold from testRelations"

da = New SqlDataAdapter( strSQL, cnn)

da.Fill(ds, "dollarsSol d")

'For simple single column relation

Dim sample As New DataRelation("h ope", ds.Tables("quan tity").Columns( "ID"),
ds.Tables("doll arsSold").Colum ns("ID"))

ds.Relations.Ad d(sample )

Me.DataGrid1.Da taSource = ds.Tables(0).De faultView

Me.DataGrid2.Da taSource = ds.Tables(1).De faultView

Me.DataGrid3.Da taSource = ds.Tables(2).De faultView ' How do I veiw the
relation???

Me.DataGrid1.Da taBind()

Me.DataGrid2.Da taBind()

Me.DataGrid3.Da taBind()

cnn.Close()

End Sub

"William Ryan" <do********@nos pam.comcast.net > wrote in message
news:ee******** ******@TK2MSFTN GP12.phx.gbl...
Julio, you can use a DataRelation and an expression column to do
this...Expressi on Columns support SUM which looks like the only aggregate
you need (they support a bunch of other ones, but that's irrelevant) You'll can use a DataRelation which will allow you to get the Group By
Functionality http://www.knowdotnet.com/articles/datarelation.html. This is important b/c if you only have one table and you use SUM(Price) for instance as the expression every row will have the same value in its SUM(Price)
column
"Julio Sarmiento" <jl*****@bellso uth.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Can anyone help me????

I have a table that I need to get the sum of four individual fields and

then
rank them from highest to lowest total. After summing up the four fields individually and ranking them, I have to place them in a single datagrid.
Example:
Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by rep (not my table!!!)

SQL Statement: Select sum(Revenue), Sum(Quantity), Sum(CreditApps) ,
Sum(Accounts).. .

Rank each column individual from highest Revenue to Lowest, from

highest
quantity to lowest etc...

My solution was to query the tables four time (1 for each field) hence
creating four datasets. I then have a sub routine that adds a field

titled
Rank to each dataset and adds the sequence number for the ranking.

NOW, I have to join the four tables but not as parent - child but as
additional fields for the same table

Outcome: Total Revenue, Ranking, Total Quantity, Ranking, Total Credit
Apps, Ranking, Total Accounts Ranking...

HOW DO I DO THAT???? HELP???

Deadline looming near!!!

Thanks,
Julio


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2894
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is loaded with historical data read from an XML file. The second dataSet has current data filled from a dataGrid.
3
16815
by: lee_mcknight | last post by:
I am using Crystal Enterprise V9. I have a report that needs to have multiple datasets as the datasource(s) on a single subreport (some common lookup data I need to join to is stored in a seperate dataset). The report is working fine with a single dataset as a datasource, but I cannot seem to find any examples of multiple datasets as a datasource. Is this possible? ReportDocument.SetDatasource() seems to only take a single dataset,...
3
2689
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to populate multiple webpages containing customer information. There isn't a one-to-one correlation between the stored procedure and a webpage. In other words, a webpage may have to refer to 1 or more DataTables to populate itself. Therefore, a...
1
1111
by: AMD Desktop | last post by:
Hi, I have one page with four reports in separate datagrids. I need to generate one report in excel format. I wrote a script that generate reports for every datagrid separately. Now, what I need is to create one master report and to combine these four datagrids into one datagrid programmatically (is it possible?) or to combine datasets before biniding and then bind this one dataset to one datagrid. Any help will be greatly appreciated.
3
2988
by: Maverick | last post by:
Assume i have 2 tables stored in a single dataSet (ds) and the relationship is well added ds.Tables("product") ds.Tables("descriptors") what I want to do is show the data from 2 of the tables, linked by the relationship, on the SAME DataGrid juz like the data is select by "Join" but i cannot find the correct code to do this. I am looking for something like:
2
1275
by: Chumley Walrus | last post by:
If I have as many as 7 different datasets I want to use, is it possible to merge 7 different datasets with the Merge method for just one datagrid? thanx chumley
4
1637
by: Dave | last post by:
(My apologies for posting this on two forums. I have just found out the other one was the incorrect location) I am writing a VB.NET 2003 web application to operate on my company's intranet. It accesses data in an SQL Server database. I have developed a couple of pages that display data successfully. However, there is one area that I am having trouble getting a handle on, despite purchasing a couple of Wrox books. Up until now, I have...
3
529
by: Julio Sarmiento | last post by:
Can anyone help me???? I have a table that I need to get the sum of four individual fields and then rank them from highest to lowest total. After summing up the four fields individually and ranking them, I have to place them in a single datagrid. Example: Table: contains fields for Revenue, Quantity, Credit Apps, Accounts by rep (not my table!!!)
3
4469
by: TomH | last post by:
I am using VB within VS 2005. How can I have multiple datagridviews on the same form pulling from the same table? e.g. I want to see all clients from New York in one view and all clients from LA in another view on the same form. I've set up a parameterized tableadapter and pass it the city. How can I load the two views in VB code when the form loads? Thanks, Tom
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.