📄 untquestions.pas
字号:
unit untQuestions;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, untBaseMD, DB, Menus, ImgList, ADODB, Grids, DBGrids, StdCtrls,
Buttons, ExtCtrls, jpeg, ComCtrls, ToolWin;
type
TfrmQuestions = class(TfrmBaseMD)
adsSinglecode: TStringField;
adsSinglegrpcode: TStringField;
adsSinglename: TStringField;
adsSinglecontent: TStringField;
adsSingleVarTag: TStringField;
adsSingleIsUsed: TBooleanField;
adsQuestionGrp: TADODataSet;
adsQuestionGrpcode: TStringField;
adsQuestionGrpname: TStringField;
adsSingleGrpName: TStringField;
adsDetailcode: TStringField;
adsDetailquestioncode: TStringField;
adsDetailselectTag: TStringField;
adsDetailcontent: TStringField;
adsDetailvalue: TIntegerField;
adsSinglexh: TStringField;
adsSingleItemDomain: TStringField;
adsSingleDescript: TStringField;
procedure FormDestroy(Sender: TObject);
procedure btnFilterClick(Sender: TObject);
private
{ Private declarations }
protected
procedure InsRecord; override;
procedure EditRecord; override;
procedure BeforeDelete(var AllowDel: Boolean); override;
public
{ Public declarations }
procedure LoadData; override;
end;
var
frmQuestions: TfrmQuestions;
implementation
uses untGlobalFun, untQuestionsSet, untGlobalVar;
{$R *.dfm}
{ TfrmQuestions }
procedure TfrmQuestions.LoadData;
begin
with adsQuestionGrp do begin
if Active then Active := false;
Active := true;
end;
inherited;
end;
procedure TfrmQuestions.FormDestroy(Sender: TObject);
begin
inherited;
frmQuestions := nil;
end;
procedure TfrmQuestions.EditRecord;
begin
inherited;
if SetQuestions(adsSingle, omModi) then
adsDetail.Requery()
else if adsSingle.State in [dsInsert, dsEdit] then
adsSingle.Cancel;
end;
procedure TfrmQuestions.InsRecord;
begin
inherited;
if SetQuestions(adsSingle, omNew) then
adsDetail.Requery()
else if adsSingle.State in [dsInsert, dsEdit] then
adsSingle.Cancel;
end;
procedure TfrmQuestions.BeforeDelete(var AllowDel: Boolean);
begin
inherited;
ExecDBCommand(Conn,
'delete from tselectitem where questioncode='
+QuotedStr(adsSingle['code']));
end;
procedure TfrmQuestions.btnFilterClick(Sender: TObject);
begin
//inherited;
ExecDBCommand(Conn,'update tquestion set XH=case when len(xh)<3 then right(''000''+XH,3)'+
' when ((len(xh)=3) and (substring(xh,3,1)>=''a'')) then right(''0000''+xh,4) ELSE xh end');
adsSingle.Close;
adsSingle.Open;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -