Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Sirchrisak
Starting Member
19 Posts |
Posted - 2005-07-29 : 16:26:01
|
Hi evrybody, I have A Query from Sql 2000 that is using compte By clause to group and compute sum value of a particular field from my table.The result when displayed with query analyser it will be segmented into diffrent sesssions and when i try to return the reault to my web page using dataset , It come in form of multible Table, If I try to bind the dataset to Datagrid in form of report, I get only values from the first table others will not display.I try to use code to join all the tables returned into one tabe so that I can Display all the rows as a report in my grid but my code seems no working .Pls can you look at the code and help me Out .One of my stress in joinng the tables into one is the tables that holds the sum of calculated values are just one colum,one row table .you can tell me if there is a better way to display such report in web page. here is my code[CODE]dt = ds.Tables(0) 'dt.Rows.Clear() dr = dt.NewRow For i = 0 To ds.Tables.Count - 1 If ds.Tables(i).Columns.Count <> 1 Then dr.Item(dt.Columns.Count - 2) = CType("Sum", String) dr.Item(dt.Columns.Count - 1) = CType(ds.Tables(i).Rows(0).Item(0), Decimal) dt.Rows.Add(dr) Else For Each dr1 In ds.Tables(i).Rows dt.ImportRow(dr1) Next End If Next Me.dgTransaction.DataSource = dt[/CODE]Chris |
|
byrmol
Shed Building SQL Farmer
1591 Posts |
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-07-29 : 17:20:35
|
I really like that series David, I am very impressed with that.rockmoose |
 |
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2005-07-29 : 17:36:46
|
Cheers rockmoose!I will post the whole library someday... it's undergone a few revisions since...DavidMA front-end is something that tries to violate a back-end. |
 |
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-07-30 : 07:34:46
|
Chris,Have You looked at the ROLLUP operator,It can do things like the COMPUTE BY clause, but will return a single resultset.quote: Cheers rockmoose!I will post the whole library someday... it's undergone a few revisions since...
Cool, I am intermittently working on something similar (but different) myself.2 steps forwards, 1.5 steps backwards.... no deadline set.rockmoose |
 |
|
|
|
|
|
|