最近遇到一个问题,在网上搜了一下,没有找到解决方案,希望有遇到过同类问题的同仁帮忙解答,具体情况为一个原来通过for   oracle的.net   framework数据提供程序需要改成oredb   的.net   framework时出现一个奇怪的问题: select   count(deptid)   from   dept   where   detpname   =   :deptname 这是一个很通用的聚合SQL了,但在OLE   DB方式下就提示   ORA-00937   不是单组分组函数错误,在网上看了些老外的帖子说原因是OLE   DB下,原来的 
select   count(deptid)   from   dept   where   detpname   =   :deptname,在提交后自动变为 
select   count(deptid),RowID   from   dept   where   detpname   =   :deptname   ,因此出现这个错误,但如果将:deptname   变成一个常量比如'财务'等就没有这个错误,老外说的解决办法为将DBPROP_MSDAORA_DETERMINEKEYCOLUMNS   设置为false,但找了好久也没有找到设置这个属性的办法,请知道的,尽快告诉我,谢谢! 
开发环境为   WINDOWSXP,ORACLE   8i,VS2005 

解决方案 »

  1.   

    嘿嘿,俺没事的时候也查了一下,好像是recordset里面的一个属性。 FYI: Using   a   server-side   recordset   is   ill-advised   for   any   database   app   that   will   require   numerous   connections   presently   or   in   the   future.     If   this   is   the   case   in   your   situation,   I   would   try   using     a   client-side   recordset   and   work   through   the   problems   you   are   having.     Perhaps   you   need   to   set   the   dynamic   property   on   the   recordset   object   and   not   the   connection   object: 
    dim   psd_rs   as   adodb.recordset 
    set   psd_rs   =   new   adodb.recordset set   psd_rs.activeconnection   =   <open   oracle   connection   variable> 
    psd_rs.properties("   DBPROP_MSDAORA_DETERMINEKEYCOLUMNS")   =   false
      

  2.   

    ADO的话用2楼的办法是可以的但我已经说了是VS2005啊,用的是ADO.NET