Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Help with DataGrid Summary Column


Message #1 by "Tim Farrell" <timothy.farrell@c...> on Wed, 9 Oct 2002 17:19:24
I have a single table in SQL2000 that contains captured data from a form.  
One of the columns captures hours.  One captures UID and one captures a 
date.  What I want to do is create a summary column in the datagrid that 
will display Total Hours: ****.

So the grid will look something like:
_________________________________________________
Action LineItem Component Activity Comments Hours
_________________________________________________ 
Delete BR0011      BR      DES               11 
Delete BR0014      BR      DES                8 
Delete BR0004      BR      INSP-FS            3 
Delete BR0008      BR      INSP-LS            2 
Delete NA          BR      ADM                8 
Delete NA          BR      RES                8 
_________________________________________________
                                 Total Hours:40  
_________________________________________________

What I have found is that using ItemDataBound is a good way to go while 
using a datagrid.  Where my experience begins to falter is in the creation 
of the stored procedure that supports this.

What I have currently is a stored procedure that calculates the total 
hours.

ALTER PROCEDURE dbo.GetTotalHours
(
  @uid nvarchar( 8 ),
  @wed datetime
)
AS
SELECT SUM(Hours)
FROM LIEF_tbl
WHERE UID = @uid AND WED = @wed

What I need to do is develop a Grouping stored procedure that will 
basically accomplish the same thing allowing me to insert it using 
ItemDataBound.

Can anyone help out with this script?

  Return to Index