SUM the fields in DataGrid

Nov 13 2007 8:41 AM
Hi

was wondering if anybody could help me. I was maid stored procedure as following:

USE [Spacva]
GO
/****** Object: StoredProcedure [dbo].[Test] Script Date: 11/13/2007 11:12:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Test]

(
@START_DATE smalldatetime,
@END_DATE smalldatetime
)

AS
BEGIN

SELECT VOZILA.ID_VOZILA, VOZILA.PROIZVODNI_POGON, VOZILA.NAZIV, VOZILA.TIP, VOZILA.REG,
SUM(TOCENJE.KOL_L) AS Quantity, SUM(TOCENJE.SATI_RADA) AS Hours, SUM(TOCENJE.PROSJEK_L_PO_H) AS Average
FROM VOZILA INNER JOIN
TOCENJE ON VOZILA.ID_VOZILA = TOCENJE.ID_VOZILA
WHERE (TOCENJE.DATUM_UNOSA BETWEEN CONVERT(SMALLDATETIME, @START_DATE, 104) AND CONVERT(SMALLDATETIME, @END_DATE, 104))
GROUP BY VOZILA.ID_VOZILA, VOZILA.PROIZVODNI_POGON, VOZILA.NAZIV, VOZILA.TIP, VOZILA.REG

END

That stored procedure I was include in my Windows C# Project, just drag and drop to Win Form. My question is, how to add footer in established DataGrid, I mean how to add SUM of all selected values from column Quantity to my DataGrid?
I'm new in SQL, Visual .NET, C# so thanks in advance for help!

Zvonimir 
 

Answers (2)