📄 unit_timuluru.pas
字号:
unit Unit_Timuluru;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, jpeg, DB, ADODB;
type
TTIMuLuRu = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Label2: TLabel;
TH_Edit1: TEdit;
Label3: TLabel;
DA_ComboBox1: TComboBox;
Label4: TLabel;
NY_ComboBox1: TComboBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
TM_Edit1: TEdit;
DAA_Edit: TEdit;
DAB_Edit: TEdit;
DAC_Edit: TEdit;
DAD_Edit: TEdit;
ZJ_ComboBox1: TComboBox;
LR_Button1: TButton;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
TH_Edit2: TEdit;
TH_Edit3: TEdit;
TH_Edit4: TEdit;
TH_Edit5: TEdit;
TH_Edit6: TEdit;
Label16: TLabel;
Kong_ComboBox: TComboBox;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
NY_ComboBox2: TComboBox;
NY_ComboBox3: TComboBox;
NY_ComboBox4: TComboBox;
NY_ComboBox5: TComboBox;
NY_ComboBox6: TComboBox;
Label23: TLabel;
Label22: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
TM_Edit2: TEdit;
Kong_Edit1: TEdit;
Kong_Edit2: TEdit;
Kong_Edit3: TEdit;
Kong_Edit4: TEdit;
ZJ_ComboBox2: TComboBox;
Label31: TLabel;
Kong_Edit5: TEdit;
LR_Button2: TButton;
TM_Memo1: TMemo;
Label32: TLabel;
DA_Memo1: TMemo;
Label33: TLabel;
ZJ_ComboBox3: TComboBox;
LR_Button3: TButton;
Label34: TLabel;
TM_Memo2: TMemo;
Label35: TLabel;
DA_Memo2: TMemo;
Label36: TLabel;
ZJ_ComboBox4: TComboBox;
LR_Button4: TButton;
Label24: TLabel;
TM_Memo3: TMemo;
Label37: TLabel;
DA_Memo3: TMemo;
Label38: TLabel;
ZJ_ComboBox5: TComboBox;
LR_Button5: TButton;
Label25: TLabel;
TM_Memo4: TMemo;
Label39: TLabel;
LR_Button6: TButton;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
Label41: TLabel;
TMYY_Edit1: TEdit;
Label42: TLabel;
DAYY_Edit1: TEdit;
Label45: TLabel;
DA1_Edit: TEdit;
DAYY1_Edit: TEdit;
Label46: TLabel;
Label47: TLabel;
DA2_Edit: TEdit;
DAYY2_Edit: TEdit;
Label48: TLabel;
Label49: TLabel;
DA3_Edit: TEdit;
DAYY3_Edit: TEdit;
Label50: TLabel;
Label51: TLabel;
DA4_Edit: TEdit;
DAYY4_Edit: TEdit;
Label52: TLabel;
Label53: TLabel;
DA5_Edit: TEdit;
DAYY5_Edit: TEdit;
Label40: TLabel;
ZJ_ComboBox6: TComboBox;
Label43: TLabel;
TMYY_Edit2: TEdit;
Label44: TLabel;
WTS_ComboBox: TComboBox;
FL1_Button: TButton;
Button1: TButton;
Image1: TImage;
Label1: TLabel;
procedure FormShow(Sender: TObject);
procedure LR_Button1Click(Sender: TObject);
procedure LR_Button2Click(Sender: TObject);
procedure LR_Button3Click(Sender: TObject);
procedure LR_Button4Click(Sender: TObject);
procedure LR_Button5Click(Sender: TObject);
procedure LR_Button6Click(Sender: TObject);
procedure FL1_ButtonClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
TIMuLuRu: TTIMuLuRu;
implementation
uses DataModule, FL_From;
{$R *.dfm}
procedure TTIMuLuRu.FormShow(Sender: TObject);
var
temp,temp1:string;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select ZJ,ZJName from ZhangJie');
ADOQuery1.Open;
while not ADOQuery1.Eof do
begin
temp:=ADOQuery1.FieldValues['ZJ']+' '+ADOQuery1.FieldValues['ZJName'];
ZJ_ComboBox1.Items.Add(temp);
ZJ_ComboBox2.Items.Add(temp);
ZJ_ComboBox3.Items.Add(temp);
ZJ_ComboBox4.Items.Add(temp);
ZJ_ComboBox5.Items.Add(temp);
ZJ_ComboBox6.Items.Add(temp);
ADOQuery1.Next;
end;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select NYD from NYD');
ADOQuery1.Open;
while not ADOQuery1.Eof do
begin
temp1:=ADOQuery1.FieldValues['NYD'];
NY_ComboBox1.Items.Add(temp1);
NY_ComboBox2.Items.Add(temp1);
NY_ComboBox3.Items.Add(temp1);
NY_ComboBox4.Items.Add(temp1);
NY_ComboBox5.Items.Add(temp1);
NY_ComboBox6.Items.Add(temp1);
ADOQuery1.Next;
end;
end;
procedure TTIMuLuRu.LR_Button1Click(Sender: TObject);
var
temp,x:integer;
temp1,temp2:string;
begin
x:=0;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select TypeID from Type where TypeName=''选择题''');
ADOQuery1.Open;
temp:=ADOQuery1.FieldValues['TypeID'];
if TM_Edit1.Text='' then ShowMessage('题目不能为空')
else if DAA_Edit.Text='' then ShowMessage('选项A不能为空')
else if DAB_Edit.Text='' then ShowMessage('选项B不能为空')
else if DAB_Edit.Text='' then ShowMessage('选项C不能为空')
else if DAB_Edit.Text='' then ShowMessage('选项D不能为空')
else if DA_ComboBox1.Text='' then ShowMessage('答案不能为空')
else if NY_ComboBox1.Text='' then ShowMessage('难易度不能为空')
else if ZJ_ComboBox1.Text='' then ShowMessage('所在章节不能为空')
else begin
temp1:=TM_Edit1.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('SELECT TM FROM XuanZeTi');
ADOQuery2.Open;
While not ADOQuery2.Eof do
begin
temp2:=ADOQuery2.FieldValues['TM'];
if temp1=temp2 then begin
x:=1;
break;
end;
ADOQuery2.Next;
end;
if x=0 then begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('INSERT INTO XuanZeTi(TypeID,TM,A,B,C,D,DA,CZ,NY) VALUES(:tp,:TM,:DAA,:DAB,:DAC,:DAD,:DA,:ZJ,:NY)');
ADOQuery1.Parameters.ParamByName('tp').Value:=temp;
ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Edit1.Text;
ADOQuery1.Parameters.ParamByName('DAA').Value:=DAA_Edit.Text;
ADOQuery1.Parameters.ParamByName('DAB').Value:=DAB_Edit.Text;
ADOQuery1.Parameters.ParamByName('DAC').Value:=DAC_Edit.Text;
ADOQuery1.Parameters.ParamByName('DAD').Value:=DAD_Edit.Text;
ADOQuery1.Parameters.ParamByName('DA').Value:=DA_ComboBox1.Text;
ADOQuery1.Parameters.ParamByName('ZJ').Value:=ZJ_ComboBox1.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('Select BH from NYD Where NYD=:NY');
ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox1.Text;
ADOQuery2.Open;
temp:=ADOQuery2.FieldValues['BH'];
ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
ADOQuery1.ExecSQL;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select 1 from XuanZeTi');
ADOQuery1.Open;
TH_Edit1.Text:=IntToStr(ADOQuery1.RecordCount+1);
TM_Edit1.Clear;
DAA_Edit.Clear;
DAB_Edit.Clear;
DAC_Edit.Clear;
DAD_Edit.Clear;
end
else showmessage('此题已经存在!');
end;
end;
procedure TTIMuLuRu.LR_Button2Click(Sender: TObject);
type
SZ=array[1..5]of string;
var
temp,x,i,y:integer;
temp1,temp2:string;
SZx:SZ;
begin
y:=0;
i:=1;
SZx[1]:='';
if TM_Edit2.Text='' then ShowMessage('题目不能为空')
else if NY_ComboBox2.Text='' then ShowMessage('难易度不能为空')
else if ZJ_ComboBox2.Text='' then ShowMessage('所在章节不能为空')
else if Kong_ComboBox.Text='' then ShowMessage('空数不能为空')
else begin
temp:=StrToInt(Kong_ComboBox.Text);
SZx[1]:=Kong_Edit1.Text;
SZx[2]:=Kong_Edit2.Text;
SZx[3]:=Kong_Edit3.Text;
SZx[4]:=Kong_Edit4.Text;
SZx[5]:=Kong_Edit5.Text;
for x:=1 To temp do
begin
i:=x;
if SZx[i]='' then break;
end;
end;
if SZx[i]='' then ShowMessage('您少输入了应填空的答案')
else begin
temp1:=TM_Edit2.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('SELECT TM FROM TianKong');
ADOQuery2.Open;
While not ADOQuery2.Eof do
begin
temp2:=ADOQuery2.FieldValues['TM'];
if temp1=temp2 then begin
y:=1;
break;
end;
ADOQuery2.Next;
end;
if y=0 then begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select TypeID From Type Where TypeName=''填空题''');
ADOQuery1.Open;
temp:=ADOQuery1.FieldValues['TypeID'];
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('INSERT INTO TianKong(TypeID,TM,K1,K2,K3,K4,K5,YTS,NY,CZ) VALUES(:temp,:TM,:K1,:K2,:K3,:K4,:K5,:YTS,:NY,:CZ)');
ADOQuery1.Parameters.ParamByName('temp').Value:=temp;
ADOQuery1.Parameters.ParamByName('TM').Value:=TM_Edit2.Text;
ADOQuery1.Parameters.ParamByName('K1').Value:=Kong_Edit1.Text;
ADOQuery1.Parameters.ParamByName('K2').Value:=Kong_Edit2.Text;
ADOQuery1.Parameters.ParamByName('K3').Value:=Kong_Edit3.Text;
ADOQuery1.Parameters.ParamByName('K4').Value:=Kong_Edit4.Text;
ADOQuery1.Parameters.ParamByName('K5').Value:=Kong_Edit5.Text;
ADOQuery1.Parameters.ParamByName('YTS').Value:=StrToInt(Kong_ComboBox.Text);
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('Select BH From NYD Where NYD=:NY');
ADOQuery2.Parameters.ParamByName('NY').Value:=NY_ComboBox2.Text;
ADOQuery2.Open;
temp:=ADOQuery2.FieldValues['BH'];
ADOQuery1.Parameters.ParamByName('NY').Value:=temp;
ADOQuery1.Parameters.ParamByName('CZ').Value:=ZJ_ComboBox2.Text;
ADOQuery1.ExecSQL;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select 1 From TianKong');
ADOQuery1.Open;
TH_Edit2.Text:=IntToStr(ADOQuery1.RecordCount+1);
TM_Edit2.Clear;
Kong_Edit1.Clear;
Kong_Edit2.Clear;
Kong_Edit3.Clear;
Kong_Edit4.Clear;
Kong_Edit5.Clear;
end
else showmessage('此题已经存在!');
end;
end;
procedure TTIMuLuRu.LR_Button3Click(Sender: TObject);
var
temp,x:Integer;
temp1,temp2:string;
begin
x:=0;
if TM_Memo1.Text='' then ShowMessage('题目不能为空')
else if DA_Memo1.Text='' then ShowMessage('答案不能为空')
else if NY_ComboBox3.Text='' then ShowMessage('难易度不能为空')
else if ZJ_ComboBox3.Text='' then ShowMessage('所在章节不能为空')
else begin
temp1:=TM_Memo1.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Add('SELECT TM FROM JianDaTi');
ADOQuery2.Open;
While not ADOQuery2.Eof do
begin
temp2:=ADOQuery2.FieldValues['TM'];
if temp1=temp2 then begin
x:=1;
break;
end;
ADOQuery2.Next;
end;
if x=0 then begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -