如题.
解决方案 »
- 像百度图片浏览的那种效果怎样实现??
- ObjectDataSource SelectParameters的问题
- 节日快乐!求asp.net论坛的源码?不要网上随处可下的
- 关于协同办公的实现
- 【精华】如何让ascx里2个DroDdownList联动起来?100分+
- 用户控件中使用服务器控件的问题
- 【求助】XP+ASP.NET 2.0+SQL server 2000+IIS;在vs2005上网站可以运行,通过IIS时,可以打开主页,和静态页,动态的可以后台管理的页打不开
- 请教:为什么DataView.RowFilter里面不能使用类似“a_b_C_d”的格式
- 向各位大哥跪求了
- 在ASP。NET的页面中动态创建HyperLink组件?我还有问题呀!帮帮我!!!!
- 请大家帮帮忙,自己编写的类库怎么编译成.dll文件??
- 放在IIS下运行,带有三个字的用户名进行登录,网页的左框架将显示为无法找到该页
这是我的SQL,在没加分组的时候没有符合条件的会给出一个0,但加了分组没有符合条件的时候就是空了.这里有没有办法让isnull()继续起作用?
datatable.Compute("isnull(sum(je),0)", "") 也报同样的错.
object o=dt.Compute("sum(je)", "je is not null")
select isnull(hdje,0) from (select isnull(round(sum(hdje),0),0) hdje from JLZF_jg where cbdh='TJ01' and bh in (select bh from JLZF_jgT where zfqh <> 0 and zfqh =10) group by left(dh,1))
这个SQL报语法错误.服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: ')' 附近有语法错误。================================================
if(dt!=buu && dt.Rows.Count>0)
object o=dt.Compute("sum(je)", "je is not null")
我就是不想麻烦因为如果这样的话我要改的地方很多.我希望直接在dt.Compute("sum(je)", "je is not null")
这一句里解决,或者直接在SQL中为空变为0.谢谢大家,请继续.
select isnull(hdje,0) from (select isnull(round(sum(hdje),0),0) hdje from JLZF_jg where cbdh='TJ01' and bh in (select bh from JLZF_jgT where zfqh <> 0 and zfqh =10) group by left(dh,1))
这个SQL报语法错误.服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: ')' 附近有语法错误。================================================
if(dt!=buu && dt.Rows.Count>0)
object o=dt.Compute("sum(je)", "je is not null")
我就是不想麻烦因为如果这样的话我要改的地方很多.我希望直接在dt.Compute("sum(je)", "je is not null")
这一句里解决,或者直接在SQL中为空变为0.谢谢大家,请继续.
(select round(sum(isnull(hdje,0)),0) as hdje from JLZF_jg where cbdh='TJ01' and bh in (select bh from JLZF_jgT where zfqh <> 0 and zfqh =10) group by left(dh,1)) a再试一下
CREATE PROCEDURE usp_GetTotalAS
DECLARE @counts int --临时记录查询结果有否有记录
DECLARE @sql nvarchar(500)
DECLARE @ParmDefinition nvarchar(500)
SET @sql = N'SELECT @counts=COUNT(*) from from JLZF_jg where cbdh=''TJ01'' and bh in (select bh from JLZF_jgT where zfqh <> 0 and zfqh =10)';
SET @ParmDefinition = N'@counts int OUTPUT';
EXECUTE sp_executesql @sql, @ParmDefinition, @counts OUTPUT;
IF @counts <>0
BEGIN
select round(sum(isnull(hdje,0)),0) as hdje from JLZF_jg where cbdh='TJ01' and bh in (select bh from JLZF_jgT where zfqh <> 0 and zfqh =10) group by left(dh,1)
END
ELSE
BEGIN
SELECT hdje=0
ENDGO
sum()不能应用于含有null值的列.这个问题在微软的官方网站上有,提出的解决办法也是修改查询语句,尽量不要返回null值,不好处理.