QueryDataset := TADODataSet.Create(nil);
with QueryDataset do
begin
Active := False;
AutoCalcFields := True;
CommandType := cmdText;
CommandTimeout := 30;
CacheSize := 1;
AutoCalcFields := True;
CursorLocation := clUseClient;
CursorType := ctKeyset;
EnableBCD := True;
Filtered := False;
Prepared := False;
LockType := ltOptimistic;
MarshalOptions := moMarshalAll;
StoreDefs := False;
Tag := 0;
connectionstring := '';
try
Connection := Conn;
except
on e:Exception do begin
Result := False;
end;
CommandText := 'Select * from table order by idx';
end;
while not QueryDataset.Eof do
begin
Inc(NumberOfQueryResult);
QueryDataset.Next();
end;
Freeandnil(QueryDataset);
如果table不做insert操作,没有问题,但如果insert 几条数据到table里面,
然后再运行以上程序,QueryDataset.Next();这里报错,好像AdoDataset指针不对了
MySQL版本:
mysql> select @@version;
+---------------------+
| @@version |
+---------------------+
| 5.0.81-community-nt |
+---------------------+
1 row in set (0.00 sec)
没见过的毛病,维护老产品用的delphi6.0开发。
QueryDataset.Next();这里报错:什么错误信息,表是否有主键
CursorType := ctDynamic
试试