菜问题

尚方宝剑彤叟无欺 2003-09-12 07:36:55
那位高手能帮帮我,以下方法如何用?
ADOQuery1.GetFieldData
...全文
33 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxpbuaa 2003-09-13
  • 打赏
  • 举报
回复
取得数据集中当前记录的第FieldNo字段的值,保存到缓冲区Buffer中。例如:
var
Buffer: Pointer;
begin
GetMem(Buffer, MAXBYTE);
ADOQuery1.GetFieldData(3, Buffer); //取得第3字段的值
ShowMessage(PChar(Buffer)); //假设值为字符串类型
FreeMem(Buffer);
end;

一般不需要直接使用这个函数,相应的可以使用TField的一些属性,如:
AsString、AsInteger、AsVariant、Value等。

—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————
Shiyl 2003-09-12
  • 打赏
  • 举报
回复
Retrieves the current value of a field into a buffer.

function GetFieldData(Field: TField; Buffer: Pointer): Boolean; override;
Description

Most applications do not need to call GetFieldData. TField objects call this method to implement their GetData method.

The Field or FieldNo parameter indicates the field whose data should be fetched. Field specifies the component itself, while FieldNo indicates its field number.

Buffer is a memory buffer with sufficient space to accept the value of the field as it exists in the database (unformatted and untranslated). GetFieldData returns a value that indicates whether the data was successfully fetched.

GetFieldData returns a boolean value indicating whether the operation was successful.
---------------------------------------------------------------------------------
自己看吧。

2,495

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧