关于VSFlexGrid绑定有出现空行的问题!

最近使用VSFlexGrid绑到DataSource为一个Oracle的Recoreset时,出现绑定的表格出现空间,有的时几行之间间断一行,有的是大片的间断.在Baidu和Google搜索了半天,也有些人和我遇到的是一样的问题,有的说Set Grid.DataSource=Rst后不关闭RecoredSet,认为是可能是还没有绑定完毕就关闭了Recordset造成的空行.这个我认为肯定是错误的,因为在一个线程里肯定不会出现这种情况的.还有的人是使用的是Unicode版的控件解决的问题.
诸如此类,我都试验了,但是都没有成功.

我将Recordset绑定到微软的MSHFlexGrid上居然没有问题,这说明我的Recordset得到的结果是肯定没有问题的,但是在使用方法上又没有错误.对于VsFlexGrid,我从7.0用到8.0,一直没有什么太大的问题,我想应该会有某种方法能够使用这种方式.于是,我首先尝试修改了Recordset的Cursortype,4个都试验了,不成功!于是我又试验了Connection的CursorLocation,将以前的客户端游标改为服务器端游标,测试,成功!!!!!

刚忙完,顺便去官方的网站上找了找,发现了有个帖子提供了解决的办法:
 got interested in your problem (we use the grid in important products, so
any bug can hit us painfully).

I think I found the reason for those empty rows: the last field in all of
them contains a date value that ADO (at least in VB) apparently cannot
digest: '0001-01-01'. If you look it up directly in the recordset, accessing
the field value yields in error

"Multi-step operation generated errors. Check each step ..."

The other field values can be accessed normally, but obviously the grid
discards the whole row content, keeping the added row as empty. After the
first error there is some strange thing happening: some of the correct row
contents do get displayed if yo scroll down far enough and then back.

I seem to remember that the lowest date value handled by ADO or VB is
something like 0100-01-01, but could not locate the reference. (The
restriction might be connected with the handling of 2-digit year format
items.)


现在就清楚了,对于我的问题来说,原来是Oracle的日期"非法",使用to_char(date,'yyyy-mm-dd')转换化,问题解决.

写此文章,希望对还在使用VB6这个老玩具,且使用VsFlexgrid的人有点帮助吧..

posted @ 2007-07-05 16:32  吴东雷  阅读(691)  评论(0编辑  收藏  举报