本文介绍了如何找出两天之间的总利润?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi在我的tblCurrencySale中包含csProfit和csDate..so,所以我现在要计算总利润
就像在我的aspx页面中,只有两个下拉列表是唯一的日期..
所以现在我想计算两个日期之间的利润
例如5/18/2012和5/30/2012,当我单击搜索时应在文本框中显示总利润..您能建议我如何给sp并在aspx.cs页中调用它吗?

感谢

hi in my tblCurrencySale contains csProfit and csDate..so now i want to calculate total profit
like in my aspx page two dropdowns r der its only date..
so now i want to calculate profit between two dates
like 5/18/2012 and 5/30/2012 when i click search should display total profit in text box..can u suggest me how to give sp and call it in aspx.cs page??

thanks

推荐答案

SELECT SUM(csProfit)
FROM tblCurrencySale
WHERE  csDate BETWEEN @startdate AND @enddate


要执行该语句,您可以使用 SqlCommand [ ^ ]


And to execute the statement you can use SqlCommand[^]


create PROCEDURE usp_CurrencyProfit
 @STARTDATE datetime,
 @ENDDATE   datetime
AS
        BEGIN
        SET NOCOUNT ON;

        SELECT ISNULL( SUM ( csProfit ) , 0 )
        FROM tblCurrencySale
        WHERE csDate BETWEEN  @STARTDATE   AND    @ENDDATE
        END
GO


这篇关于如何找出两天之间的总利润?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 23:25