为什么当我把adodataset的cursortype属性设为ctkeyset时,再把active设为true时,它会自动改为ctstatic.为什么,我应该怎么设?

解决方案 »

  1.   

    虽然不知道有什么用,帮你查了一下help
    看见这么一条:
    Only ctStatic is supported if the CursorLocation property of the ADO dataset component is set to clUseClient.相信应该知道原因了吧~
      

  2.   

    不行呀,我把cluseclient改为cluseserver还是如此
      

  3.   

    啊~~那就只有在看看这条了:If the requested cursor type is not supported by the provider, the provider may return another cursor type. This alternate cursor type is reflected in the CursorType property after the recordset is opened.顺便问一句,这么设置的目的是什么啊~
      

  4.   

    怎么会呢??
    我用adodataset连接access数据库,如果把corsorlocation设置成为了cluseserver
    那个cursortype就不会自动改变了~
    但是如果是 cluseclient就会出现你说的那种情况~如果你那样不可以,肯定是你的数据库不支持这种corsortype了~也就是我给你看的第二条的原因了~
      

  5.   

    我用的是SQL_server,我想应该支持的吧.
      

  6.   

    我也用sql试了,不行~但是根据你想要的功能,在看看cursortype的取值含义:
    1."ctUnspecified"   A specific cursor type has not yet been specified.
    2."ctOpenForwardOnly"   Forward-only cursor in which you can only scroll forward; better performance because only requires single through recordset.
    3."ctKeyset" Keyset cursor; records added by other users are not visible; records deleted by other users are inaccessible.
    4."ctDynamic" Dynamic cursor; data modifications, deletions, and insertions by other users are visible; scrolling forward and back allowed.
    5."ctStatic" Static cursor; static copy of records; data changes by other users not visible; used mostly for reporting.可以看出,实际上ctKeyset不能满足你的需要,ctDynamic才行,我试的时候当把adodataset.active设置成true的时候这个值也正好被自动设置成了ctDynamic(注意此时的cursorLocation必须是cluseserver)。
      

  7.   

    兄弟介绍一本李维的说给你DELPHI5.0ado/mts高级编程