我再dbgrid的 onDrawColumnCell事件中编写代码,为什么我用adoQuery 就能获取到RecNo 但是通过TQuery 获取到的为什么总是 -1 呢?
解决方案 »
- 关于注册表
- 关于源代码管理软件
- 一个关于stringgrid的问题,请高人帮我看一下
- 在两台机器上运行着相同的一个程序,一台做主机,一台做旁观,怎样通过Socket做到两台机器运行的程序同步
- delphi程序使用中的问题!高手进来看一下!
- 在DELHPI中除了用定时器以外还有什么办法可以实现循环?
- 我下载了fast report251,但按照到delphi7的时候打开老是出错
- 请教:如何判断某个位置是否有同名文件?
- 高手指教
- 两万块会不会太少???????????????????????
- 精通ReportMachine的请进来看一下。
- 【板务醒目】辞去 Windows SDK/API 板斑竹职务 5/10【散分醒目】
adoquery.cursorlocation := clUseClient;
adoquery.cursortype := ctKeyset;
adoquery.locktype := ltOptimistic;试试
而我建议的方法是,在数据表设计中加一唯一ID
Indicates the active record in the dataset.
Class
TDataSet Syntax
[Delphi] property RecNo: Integer read GetRecNo write SetRecNo;
Description
As implemented in TDataSet, the value of RecNo is always -1. Ordinarily an application does not access RecNo at the TDataSet level. Instead a re-implemented RecNo property in a descendant class such as TTable is accessed. RecNo provides a fallback property for derived datasets that do not support record numbers.
=======================================================
adoquery.cursorlocation := clUseClient
使用客户端游标,可以获得记录集的记录数,使用服务端游标,就无法得到记录集的记录数。还属性与RecNo 无关。