请教一下如何用c#,实现提取数据库中的sum值 20

下面是我的代码protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse){DataCo... 下面是我的代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
DataControlRowType itemType = e.Row.RowType;
if (e.Row.RowType == DataControlRowType.Header || e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "javascript:setMouseOverColor(this);";
e.Row.Attributes["onmouseout"] = "javascript:setMouseOutColor(this);";
}

if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lzn = (Label)e.Row.FindControl("lzid");
Label lzl = (Label)e.Row.FindControl("lznum");
string SQL_GetSum_lz = "select Sum(JcXiangMu) from qp_hr_YGJC where BuMenId in (" + Session["BmQx"] + ") and BuMenId='" + lzn.Text + "' and (JcShijian between '" + StartTime.Text + "'and '" + EndTime.Text + "' or convert(char(10),cast(JcShijian as datetime),120)=convert(char(10),cast('" + StartTime.Text + "' as datetime),120) or convert(char(10),cast(JcShijian as datetime),120)=convert(char(10),cast('" + EndTime.Text + "' as datetime),120) ) ";
string count_lz = "" + List.GetSum(SQL_GetSum_lz) + "";

lzl.Text = null;
lzl.Text = "<a href=\"javascript:void(0)\" onclick=\"openfrom1('StartTime=" + StartTime.Text + "&EndTime=" + EndTime.Text + "&BuMenId=" + lzn.Text + "')\">" + count_lz + "</a>";
//总额
}
}
展开
 我来答
匿名用户
2014-04-07
展开全部
你的代码在哪里?我只是来水经验的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
揭菱华06S
2014-04-03 · TA获得超过118个赞
知道答主
回答量:78
采纳率:0%
帮助的人:34.1万
展开全部
干嘛不在数据库里算好?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式