恼人的OleDb Bug

今天写程序时用oledbcommand执行一条sql语句:

cmd.ExecuteScalar(“select count(distinct field) from table1“)

谁知这条在sql plus上运行得好好的语句,到了oledb提供程序那里却

给它乱改一通。实际运行它硬会自作聪明把 distinct field之间的空格

去掉,自然table1里当然没有叫distinctfield的字段了。无奈只能换个方法

用自查询代替。

我的运行环境是vs2002,数据库是oracle。不知其它情况下会不会一样。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus