MySql.Data.MySqlClient.MySqlException 7/9

終於捕到這個錯誤:
MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first.

查詢語法如下:
select distinct a.ccode as code,concat(a.ccode,'-',csname) as name
FROM pay_yingfu as a,cod_codes as b,bas_refers as c
where a.ccode=b.ccode and c.kind='2108' and b.jzfs=c.no
and concat(date_format(date_add(concat(left(a.ym,4),'-',right(a.ym,2),'-01'),interval c.mark2*1 month),'%Y-%m'),(if(mod(c.mark1*1,30)=0,'-25','-15')))<='2007-07-09' 
and flag in ('1','2')
order by a.ccode

在phpmyadmin及其他查詢工具中執行正常,但若程式調用就出錯,上周未報過錯,這周開始@_@

原來在where中還需要加入判斷:and (b.jzfs<>'' or b.jzfs<>null)即可正常^__^

7.12又出現了@_@,它像一枚炸彈,會不定時爆發
當通過代碼調試後就正常,難道是欠調嗎?好象不只這次的情況,其他情況沒有這麽頻繁
這好像不是SQL的問題,會不會是VS2005之MYSQL DATA本身的問題呢?比如本身沒有設定像我上面這麽複雜的多重查詢,當經過調試,它就默認了此種情形

转载于:https://www.cnblogs.com/daisylh/archive/2007/07/09/810752.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值