📄 systemlog.~pas
字号:
unit SystemLog;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, ImgList, ExtCtrls, Grids, StdCtrls;
type
TSystemForm = class(TForm)
Panel1: TPanel;
Splitter1: TSplitter;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
ImageList1: TImageList;
ImageList2: TImageList;
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
StringGrid1: TStringGrid;
TreeView1: TTreeView;
ToolButton1: TToolButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
private
{ Private declarations }
procedure StrView;
public
{ Public declarations }
end;
var
SystemForm: TSystemForm;
implementation
uses main,DBM,inc;
{$R *.dfm}
procedure TSystemForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
delTabs('日志管理');
end;
procedure TSystemForm.StrView;
var
sqlStr:string;
i:integer;
whereSql,cStr:string;
begin
StringGridClear(StringGrid1);
sqlStr:='select * from Logs' ;
i:=1;
StringGrid1.ColCount :=4;
StringGrid1.ColWidths [0]:=40;
StringGrid1.Cells[0,0]:='编号';
StringGrid1.ColWidths [1]:=120;
StringGrid1.Cells[1,0]:='操作人';
StringGrid1.ColWidths [2]:=150;
StringGrid1.Cells[2,0]:='操作时间';
StringGrid1.ColWidths [3]:=200;
StringGrid1.Cells[3,0]:='操作状态';
with DM.LogADOQuery do begin
Close;
SQL.Clear;
SQL.Add(sqlStr);
Open;
if RecordCount=0 then
StringGrid1.RowCount :=RecordCount+2
else
StringGrid1.RowCount :=RecordCount+1;
StringGrid1.FixedRows :=1;
while not Eof do begin
StringGrid1.Cells[0,i]:=FieldValues['L_ID'];
StringGrid1.Cells[1,i]:=FieldValues['E_NAME'];
StringGrid1.Cells[2,i]:=FieldValues['L_DATE'];
StringGrid1.Cells[3,i]:=FieldValues['L_OPERATE'];
i:=i+1;
Next;
end;
end;
end;
procedure TSystemForm.FormShow(Sender: TObject);
begin
StrView;
end;
procedure TSystemForm.ToolButton6Click(Sender: TObject);
begin
Close;
end;
procedure TSystemForm.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
SelName:=StringGrid1.Cells[0,ARow];
end;
procedure TSystemForm.ToolButton3Click(Sender: TObject);
begin
if SelName='' then Exit;
with DM.LogADOQuery do begin
Close;
SQL.Clear;
SQL.Add('delete Logs where L_ID='+SelName);
ExecSQL;
MessageDlg('数据删除成功', mtInformation,[mbOk], 0);
StrView;
end;
end;
procedure TSystemForm.ToolButton4Click(Sender: TObject);
begin
//frxUserDataset1.RangeEnd :=reCount;
//frxUserDataset1.RangeEndCount :=StringGrid1.RowCount;
// frxReport1.ShowReport;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -