12 2009 档案
摘要:用Delphi从数据库中取得资料,然后导出到Excel中做成报表是个不错的选择,因为Excel强大的报表功能那可是没话说前提Delphi中要 uses comobj;var Excel:Variant;一、Excel操作1.创建Excel对象Excel := CreateOleObject( Excel.Application );2.显示ExcelExcel.Visible:=true;3.更改...
阅读全文
摘要:delphi在执行双击事件的顺序是 OnMouseDown,OnMouseUp,Onclick,OnMouseDown,OnMouseUp,OnDleClick。所以,要在OnMouseDown中判断是否执行了双机事件,有点难度。
阅读全文
摘要:一、四舍五入法四舍五入是一种应用非常广泛的近似计算方法,其有算术舍入法和银行家舍入法两种。所谓算术舍入法,就是我们通常意义上的四舍五入法。其规则是:当舍去位的数值大于等于5时,在舍去该位的同时向前位进一;当舍去位的数值小于5时,则直接舍去该位。所谓银行家舍入法,其实质是一种四舍六入五留双(又称四舍六入五奇偶)法。其规则是:当舍去位的数值小于5时,直接舍去该位;当舍去位的数值大于等于6时,在舍去该位...
阅读全文
摘要:procedure TFrmMain.NSystBackupClick(Sender: TObject);var strFile:string;begin // 数据库备份 SaveDlgData.Filter:='All files (*.*)|*.*'; SaveDlgData.FileName:='DataBack'+DateToStr(now); if SaveDlgData.Execut...
阅读全文
摘要:MessageBox用法消息框是个很常用的控件,属性比较多,本文列出了它的一些常用方法,及指出了它的一些应用场合。1.MessageBox("这是一个最简单的消息框!");2.MessageBox("这是一个有标题的消息框!","标题"); 3.MessageBox("这是一个确定 取消的消息框!","标题", MB_OKCANCEL ); 4.MessageBox("这是一个警告的消息框!","...
阅读全文
摘要://Delphi中打开Excel文件var ExcelApp: Variant; //Excel变量 ExcelFiles: string; //打开的Excel文件名begin inherited; //打开指定的文件 OpenDialog1.InitialDir := ExtractFilePath(ParamStr(0)) + '.\data\'; OpenDialog1.Filter :=...
阅读全文
摘要://判断文件是否存在 if not FileExists(trim(RzButtonEdit1.Text)) then begin Application.MessageBox('指定的数据源文件不存在!', '请您注意', 48); exit; end;
阅读全文
摘要:procedure TMainForm.edtListViewIndexKeyPress(Sender: TObject; var Key: Char); begin if not (Key in ['0'..'9', #8]) then Key := #0; end;在ONKEYPRESS里写下procedure Tform1.Edit1KeyPress(Sender: TObject; var...
阅读全文
摘要:for i := 0 to self.ComponentCount - 1 do begin if Components[i] is TRzEdit then begin TRzEdit(Components[i]).Clear; TRzEdit(Components[i]).Modified := false; end; end;
阅读全文
摘要://打开指定的文件 OpenDialog1.InitialDir := ExtractFilePath(ParamStr(0)) + '.\data\'; OpenDialog1.Filter := '*.XLS'; OpenDialog1.Title := '打开Excel文件'; OpenDialog1.FileName := ''; if OpenDialog1.Execute then E...
阅读全文
摘要:方法一: ADOQtemp.Close; ADOQtemp.Connection := DM.ADOConnection1; ADOQtemp.SQL.Clear; ADOQtemp.Parameters.Clear; ADOQtemp.SQL.Add('insert into LabelMainInfo() select * from tempLabelMainInfo where Operat...
阅读全文
摘要:// 根据设置返回本机时间或服务器时间 tempServerDate := date; if gGetServerDate then begin ADOQtemp.Close; ADOQtemp.Connection := DM.ADOConnection1; ADOQtemp.SQL.Clear; ADOQtemp.SQL.Add('SELECT GETDATE() AS tempSQLSer...
阅读全文
摘要:var maxbh: string;begin inherited; RzDateTimeEdit1.date := now; //计算序列号 ADOQuery1.Close; ADOQuery1.Connection := DM.ADOConnection1; ADOQuery1.SQL.Clear; ADOQuery1.Parameters.Clear; ADOQuery1.SQL.Add('...
阅读全文