zoukankan      html  css  js  c++  java
  • 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本身的問題呢?比如本身沒有設定像我上面這麽複雜的多重查詢,當經過調試,它就默認了此種情形
  • 相关阅读:
    Python基础:28正则表达式
    Remove Duplicates from Sorted Array
    Reverse Nodes in k-Group
    Merge k Sorted Lists
    Generate Parentheses
    Container With Most Water
    Regular Expression Matching
    Median of Two Sorted Arrays
    sql 子查询
    linux安装服务器
  • 原文地址:https://www.cnblogs.com/daisylh/p/810752.html
Copyright © 2011-2022 走看看