unit U_AdoFunc; interface uses Windows, SysUtils, Messages, Classes, Controls, StdCtrls, ComCtrls, Forms, ExtCtrls, ComObj, ActiveX, cxMemo, cxButtons, Graphics, IniFiles, Dialogs, Menus, DB, ADODB,Dbclient ; implementation function writeSysLog(AdoCmd:TADOQuery;cds_data:TclientDataSet):boolean; var i:Integer; mfieldName:string; begin result:=false; try with AdoCmd do begin close; sql.clear; sql.add('select * from SY_SysLog where 1=2'); open; cds_data.First; while cds_data.eof do begin append; for I := 0 to cds_data.FieldCount-1 do begin FieldByName(mfieldName).value:=cds_data.FieldByName(mfieldName).value ; end; post; cds_data.Next; end; end; result:=true; except Application.MessageBox('写数据日志时发生错误!','警告信息'); end; end; end.