Unit8.pas
上传用户:szyozho
上传日期:2013-04-13
资源大小:3688k
文件大小:46k
源码类别:

教育系统应用

开发平台:

Delphi

  1. unit Unit8;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, DBCtrls, Mask, ExtCtrls, Buttons, Grids, DBGrids,
  6.   ComCtrls, DB, DBTables;
  7. type
  8.   Tjudgeform = class(TForm)
  9.     PageControl1: TPageControl;
  10.     TabSheet1: TTabSheet;
  11.     TabSheet2: TTabSheet;
  12.     Label1: TLabel;
  13.     Label2: TLabel;
  14.     Label4: TLabel;
  15.     Label5: TLabel;
  16.     DBEdit1: TDBEdit;
  17.     DBMemo1: TDBMemo;
  18.     DBEdit2: TDBEdit;
  19.     DBRadioGroup1: TDBRadioGroup;
  20.     Panel1: TPanel;
  21.     DBNavigator1: TDBNavigator;
  22.     BitBtn1: TBitBtn;
  23.     DBGrid1: TDBGrid;
  24.     DBMemo2: TDBMemo;
  25.     DBNavigator2: TDBNavigator;
  26.     DataSource1: TDataSource;
  27.     Query1: TQuery;
  28.     TreeView1: TTreeView;
  29.     BitBtn2: TBitBtn;
  30.     BitBtn3: TBitBtn;
  31.     Query2: TQuery;
  32.     DBComboBox1: TDBComboBox;
  33.     Label3: TLabel;
  34.     Label6: TLabel;
  35.     function checknewjudge:boolean;
  36.     procedure RadioButton1Click(Sender: TObject);
  37.     procedure FormActivate(Sender: TObject);
  38.     procedure TabSheet1Show(Sender: TObject);
  39.     procedure TabSheet2Show(Sender: TObject);
  40.     procedure DBNavigator2Click(Sender: TObject; Button: TNavigateBtn);
  41.     procedure TreeView1Click(Sender: TObject);
  42.     procedure BitBtn3Click(Sender: TObject);
  43.     procedure BitBtn2Click(Sender: TObject);
  44.     procedure FormCreate(Sender: TObject);
  45.     procedure TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
  46.       Shift: TShiftState; X, Y: Integer);
  47.     procedure DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
  48.     procedure DBEdit1Change(Sender: TObject);
  49.   private
  50.     { Private declarations }
  51.   public
  52.   temp:integer;
  53.     { Public declarations }
  54.   end;
  55. var
  56.   judgeform: Tjudgeform;
  57.    addjudge:boolean;
  58. implementation
  59. uses Unit4, Unit3;
  60. {$R *.dfm}
  61. function Tjudgeform.checknewjudge:boolean;
  62. var
  63. success:boolean;
  64. begin
  65. success:=true;
  66. with DataModule4.Table_judge do
  67. begin
  68. if DBEdit1.Text='' then
  69. success:=false;
  70. if DBComboBox1.Text='' then
  71. success:=false;
  72. if DBMemo1.Text='' then
  73. success:=false;
  74. if DBRadioGroup1.Value='' then
  75. success:=false;
  76. //if DBRadioGroup1.
  77. //if DBRadioGroup1.
  78. if not success then
  79. begin
  80. showmessage('红色项必须填写,请补上未填的红色项!');
  81. end;
  82.   checknewjudge:=success;
  83. end;
  84. end;
  85. procedure Tjudgeform.RadioButton1Click(Sender: TObject);
  86. begin
  87. //if DBEdit1<>'' then
  88. begin
  89. end;
  90. end;
  91. procedure Tjudgeform.FormActivate(Sender: TObject);
  92. begin
  93. DBNavigator1.DataSource:=DataModule4.DataSource_judge;
  94. DBNavigator2.Enabled:=false;
  95. end;
  96. procedure Tjudgeform.TabSheet1Show(Sender: TObject);
  97. begin
  98.      DBNavigator2.Enabled:=true;
  99. DBNavigator2.DataSource:=DataModule4.DataSource_judge;
  100. end;
  101. procedure Tjudgeform.TabSheet2Show(Sender: TObject);
  102. begin
  103. DBNavigator2.Enabled:=false;
  104.  DBNavigator1.DataSource:=DataModule4.DataSource_judge;
  105. end;
  106. procedure Tjudgeform.DBNavigator2Click(Sender: TObject; Button: TNavigateBtn);
  107. begin
  108.  DBMemo1.DataSource:=DataModule4.DataSource_judge;
  109.   DBEdit1.DataSource:=DataModule4.DataSource_judge;
  110.   DBEdit2.DataSource:=DataModule4.DataSource_judge ;
  111.   DBComboBox1.DataSource:=DataModule4.DataSource_judge;
  112.   DBRadioGroup1.DataSource:=DataModule4.DataSource_judge ;
  113.  case button of
  114.    nbDelete:
  115.    begin
  116.    
  117. if Treeview1.Focused=false then
  118. begin
  119. DBNavigator2.BtnClick(nbCancel);
  120. showmessage('请选择一个章节点') ;
  121.   DBNavigator2.BtnClick(nbCancel);
  122.   DBNavigator2.Enabled:=false;
  123. end
  124. else
  125. query2.close;
  126. query2.sql.clear;
  127. query2.sql.text:='delete ti_judge where tno='''+inttostr(mainform.updateno)+''' ';
  128. query2.ExecSQL;
  129. query2.close;
  130. query2.sql.clear;
  131. query2.sql.text:='update ti_judge set tno=tno-1 where tno>'''+inttostr(mainform.updateno)+''' and tno like '''+inttostr(mainform.updateno div 10)+'%''';
  132. query2.ExecSQL;
  133. DBNavigator1.DataSource:=DataModule4.DataSource_judge;
  134.   showmessage(inttostr(DataModule4.Table_judge.FieldValues['tno']));
  135.    end;
  136.    end;
  137.   
  138. case button of
  139. nbInsert:
  140. begin
  141. addjudge:=true;
  142. if Treeview1.Focused=false then
  143. begin
  144. showmessage('请选择一个章节点') ;
  145.   DBNavigator2.BtnClick(nbCancel);
  146.    DBNavigator2.Enabled:=false;
  147. end
  148. else
  149. if treeview1.Focused=true then
  150. begin
  151.  DBNavigator2.Enabled:=false;
  152. if (temp mod 10)=0 then
  153. begin
  154. showmessage('本章知识点已满!');
  155. DBNavigator2.BtnClick(nbCancel);
  156. end
  157. else
  158. begin
  159. DBEdit1.text:=inttostr(temp);
  160. end;
  161. end;
  162. end;
  163. end;
  164. case button of
  165. nbPost:
  166. begin
  167. DataModule4.Table_judge.Close;
  168. DataModule4.Table_judge.Open;
  169. end;
  170. end;
  171. end;
  172. procedure Tjudgeform.TreeView1Click(Sender: TObject);
  173. begin
  174. {
  175. if TreeView1.Selected.text='C语言' then    //总节点
  176.    begin
  177.   query1.Active:=false;
  178.   query1.Active:=true;
  179. if(query1.Active=true)then
  180. begin
  181. query1.Close;
  182. query1.SQL.Clear;
  183. query1.SQL.Add('select * from ti_choose');
  184. query1.Open;
  185.  end;
  186.  end;           }
  187.                    {
  188.  if TreeView1.Selected.text='第一章 C语言基础知识' then   //第一章
  189.    begin
  190.   query1.Active:=false;
  191.   query1.Active:=true;
  192. if(query1.Active=true)then
  193. begin
  194. query1.Close;
  195. query1.SQL.Clear;
  196. query1.SQL.Add('select * from ti_choose where tno like ''1%%%''');
  197. query1.Open;
  198.  end;
  199.  end;
  200.                        }
  201.                        {
  202.      if TreeView1.Selected.text='第一节' then         //第一章第一节
  203.    begin
  204.   query1.Active:=false;
  205.   query1.Active:=true;
  206. if(query1.Active=true)then
  207. begin
  208. query1.Close;
  209. query1.SQL.Clear;
  210. query1.SQL.Add('select * from ti_choose where tno like ''11%%''');
  211. query1.Open;
  212.  end;
  213.  end;
  214.                         }
  215.  if TreeView1.Selected.text='第一知识点 C语言的特点' then  //第一章第一节第一知识点
  216.    begin
  217.   query1.Active:=false;
  218.   query1.Active:=true;
  219. if(query1.Active=true)then
  220. begin
  221. query1.Close;
  222. query1.SQL.Clear;
  223. query1.SQL.Add('select * from ti_judge where tno like ''111%'' order by tno');
  224. query1.Open;
  225. begin
  226.   if query1.RecordCount<>0 then
  227.   begin
  228.   query1.Last;
  229.   temp:=query1.FieldValues['tno']+1;
  230.   end
  231.   else if query1.RecordCount=0 then
  232.   begin
  233.      temp:=1111;
  234.   end;
  235. end;
  236.  end;
  237.  end;
  238.                           {
  239.  if TreeView1.Selected.text='第二节' then      //第一章第二节
  240.    begin
  241.   query1.Active:=false;
  242.   query1.Active:=true;
  243. if(query1.Active=true)then
  244. begin
  245. query1.Close;
  246. query1.SQL.Clear;
  247. query1.SQL.Add('select * from ti_choose where tno like ''12%%''');
  248. query1.Open;
  249.  end;
  250.  end;
  251.                               }
  252.  if TreeView1.Selected.text='第一知识点 C语言的标识符和保留字' then  //第一章第二节第一知识点
  253.    begin
  254.   query1.Active:=false;
  255.   query1.Active:=true;
  256. if(query1.Active=true)then
  257. begin
  258. query1.Close;
  259. query1.SQL.Clear;
  260. query1.SQL.Add('select * from ti_judge where tno like ''121%'' order by tno');
  261. query1.Open;
  262. begin
  263.   if query1.RecordCount<>0 then
  264.   begin
  265.   query1.Last;
  266.   temp:=query1.FieldValues['tno']+1;
  267.   end
  268.   else if query1.RecordCount=0 then
  269.   begin
  270.      temp:=1211;
  271.   end;
  272. end;
  273.  end;
  274.  end;
  275.  {
  276.  
  277.      if TreeView1.Selected.text='第三节' then    //第一章第三节
  278.    begin
  279.   query1.Active:=false;
  280.   query1.Active:=true;
  281. if(query1.Active=true)then
  282. begin
  283. query1.Close;
  284. query1.SQL.Clear;
  285. query1.SQL.Add('select * from ti_choose where tno like ''13%%''');
  286. query1.Open;
  287.  end;
  288.  end;
  289.                            }
  290. if TreeView1.Selected.text='第一知识点 C程序的结构' then      //第一章第三节第一知识点
  291.    begin
  292.   query1.Active:=false;
  293.   query1.Active:=true;
  294. if(query1.Active=true)then
  295. begin
  296. query1.Close;
  297. query1.SQL.Clear;
  298. query1.SQL.Add('select * from ti_judge where tno like ''131%'' order by tno');
  299. query1.Open;
  300. begin
  301.   if query1.RecordCount<>0 then
  302.   begin
  303.   query1.Last;
  304.   temp:=query1.FieldValues['tno']+1;
  305.   end
  306.   else if query1.RecordCount=0 then
  307.   begin
  308.      temp:=1311;
  309.   end;
  310. end;
  311.  end;
  312.  end;
  313.                         {
  314.  if TreeView1.Selected.text='第四节' then             //第一章第四节
  315.    begin
  316.   query1.Active:=false;
  317.   query1.Active:=true;
  318. if(query1.Active=true)then
  319. begin
  320. query1.Close;
  321. query1.SQL.Clear;
  322. query1.SQL.Add('select * from ti_choose where tno like ''14%%''');
  323. query1.Open;
  324.  end;
  325.  end;
  326.                             }
  327. if TreeView1.Selected.text='第一知识点 C程序的开发过程' then     //第一章第四节第一知识点
  328.    begin
  329.   query1.Active:=false;
  330.   query1.Active:=true;
  331. if(query1.Active=true)then
  332. begin
  333. query1.Close;
  334. query1.SQL.Clear;
  335. query1.SQL.Add('select * from ti_judge where tno like ''141%'' order by tno');
  336. query1.Open;
  337. begin
  338.   if query1.RecordCount<>0 then
  339.   begin
  340.   query1.Last;
  341.   temp:=query1.FieldValues['tno']+1;
  342.   end
  343.   else if query1.RecordCount=0 then
  344.   begin
  345.      temp:=1411;
  346.   end;
  347. end;
  348.  end;
  349.  end;
  350.  //-----------------------------------------------------------------
  351.  {
  352.  if TreeView1.Selected.text='第二章 数据类型、运算符与表达式' then
  353.    begin
  354.   query1.Active:=false;
  355.   query1.Active:=true;
  356. if(query1.Active=true)then
  357. begin
  358. query1.Close;
  359. query1.SQL.Clear;
  360. query1.SQL.Add('select * from ti_choose where tno like ''2%%%''');
  361. query1.Open;
  362.  end;
  363.  end;
  364.                      }
  365.                      {
  366. if TreeView1.Selected.text='第一节' then
  367.    begin
  368.   query1.Active:=false;
  369.   query1.Active:=true;
  370. if(query1.Active=true)then
  371. begin
  372. query1.Close;
  373. query1.SQL.Clear;
  374. query1.SQL.Add('select * from ti_choose where tno like ''21%%''');
  375. query1.Open;
  376.  end;
  377.  end;
  378.                              }
  379. if TreeView1.Selected.text='第一知识点 C语言数据类型' then   //第二章第一节第一知识点
  380.    begin
  381.   query1.Active:=false;
  382.   query1.Active:=true;
  383. if(query1.Active=true)then
  384. begin
  385. query1.Close;
  386. query1.SQL.Clear;
  387. query1.SQL.Add('select * from ti_judge where tno like ''211%'' order by tno');
  388. query1.Open;
  389. begin
  390.   if query1.RecordCount<>0 then
  391.   begin
  392.   query1.Last;
  393.   temp:=query1.FieldValues['tno']+1;
  394.   end
  395.   else if query1.RecordCount=0 then
  396.   begin
  397.      temp:=2111;
  398.   end;
  399. end;
  400.  end;
  401.  end;
  402. if TreeView1.Selected.text='第二知识点 整型数据' then
  403.    begin
  404.   query1.Active:=false;
  405.   query1.Active:=true;
  406. if(query1.Active=true)then
  407. begin
  408. query1.Close;
  409. query1.SQL.Clear;
  410. query1.SQL.Add('select * from ti_judge where tno like ''212%'' order by tno');
  411. query1.Open;
  412. begin
  413.   if query1.RecordCount<>0 then
  414.   begin
  415.   query1.Last;
  416.   temp:=query1.FieldValues['tno']+1;
  417.   end
  418.   else if query1.RecordCount=0 then
  419.   begin
  420.      temp:=2121;
  421.   end;
  422. end;
  423.  end;
  424.  end;
  425. if TreeView1.Selected.text='第三知识点 实型数据' then
  426.    begin
  427.   query1.Active:=false;
  428.   query1.Active:=true;
  429. if(query1.Active=true)then
  430. begin
  431. query1.Close;
  432. query1.SQL.Clear;
  433. query1.SQL.Add('select * from ti_judge where tno like ''213%'' order by tno');
  434. query1.Open;
  435. begin
  436.   if query1.RecordCount<>0 then
  437.   begin
  438.   query1.Last;
  439.   temp:=query1.FieldValues['tno']+1;
  440.   end
  441.   else if query1.RecordCount=0 then
  442.   begin
  443.      temp:=2131;
  444.   end;
  445. end;
  446.  end;
  447.  end;
  448. if TreeView1.Selected.text='第四知识点 字符型数据' then
  449.    begin
  450.   query1.Active:=false;
  451.   query1.Active:=true;
  452. if(query1.Active=true)then
  453. begin
  454. query1.Close;
  455. query1.SQL.Clear;
  456. query1.SQL.Add('select * from ti_judge where tno like ''214%'' order by tno');
  457. query1.Open;
  458. begin
  459.   if query1.RecordCount<>0 then
  460.   begin
  461.   query1.Last;
  462.   temp:=query1.FieldValues['tno']+1;
  463.   end
  464.   else if query1.RecordCount=0 then
  465.   begin
  466.      temp:=2141;
  467.   end;
  468. end;
  469.  end;
  470.  end;
  471.                       //---------------------------------------
  472.                       {
  473. if TreeView1.Selected.text='第二节' then
  474.    begin
  475.   query1.Active:=false;
  476.   query1.Active:=true;
  477. if(query1.Active=true)then
  478. begin
  479. query1.Close;
  480. query1.SQL.Clear;
  481. query1.SQL.Add('select * from ti_choose where tno like ''22%%''');
  482. query1.Open;
  483.  end;
  484.  end;
  485.                              }
  486. if TreeView1.Selected.text='第一知识点 运算符' then
  487.    begin
  488.   query1.Active:=false;
  489.   query1.Active:=true;
  490. if(query1.Active=true)then
  491. begin
  492. query1.Close;
  493. query1.SQL.Clear;
  494. query1.SQL.Add('select * from ti_judge where tno like ''221%'' order by tno');
  495. query1.Open;
  496. begin
  497.   if query1.RecordCount<>0 then
  498.   begin
  499.   query1.Last;
  500.   temp:=query1.FieldValues['tno']+1;
  501.   end
  502.   else if query1.RecordCount=0 then
  503.   begin
  504.      temp:=2211;
  505.   end;
  506. end;
  507.  end;
  508.  end;
  509. if TreeView1.Selected.text='第二知识点 位运算' then
  510.    begin
  511.   query1.Active:=false;
  512.   query1.Active:=true;
  513. if(query1.Active=true)then
  514. begin
  515. query1.Close;
  516. query1.SQL.Clear;
  517. query1.SQL.Add('select * from ti_judge where tno like ''222%'' order by tno');
  518. query1.Open;
  519. begin
  520.   if query1.RecordCount<>0 then
  521.   begin
  522.   query1.Last;
  523.   temp:=query1.FieldValues['tno']+1;
  524.   end
  525.   else if query1.RecordCount=0 then
  526.   begin
  527.      temp:=2221;
  528.   end;
  529. end;
  530.  end;
  531.  end;
  532.  //-----------------------------------
  533.  {
  534. if TreeView1.Selected.text='第三节' then
  535.    begin
  536.   query1.Active:=false;
  537.   query1.Active:=true;
  538. if(query1.Active=true)then
  539. begin
  540. query1.Close;
  541. query1.SQL.Clear;
  542. query1.SQL.Add('select * from ti_choose where tno like ''23%%''');
  543. query1.Open;
  544.  end;
  545.  end;
  546.                          }
  547. if TreeView1.Selected.text='第一知识点 表达式' then
  548.    begin
  549.   query1.Active:=false;
  550.   query1.Active:=true;
  551. if(query1.Active=true)then
  552. begin
  553. query1.Close;
  554. query1.SQL.Clear;
  555. query1.SQL.Add('select * from ti_judge where tno like ''231%'' order by tno');
  556. query1.Open;
  557. begin
  558.   if query1.RecordCount<>0 then
  559.   begin
  560.   query1.Last;
  561.   temp:=query1.FieldValues['tno']+1;
  562.   end
  563.   else if query1.RecordCount=0 then
  564.   begin
  565.      temp:=2311;
  566.   end;
  567. end;
  568.  end;
  569.  end;
  570. if TreeView1.Selected.text='第二知识点 类型转换' then
  571.    begin
  572.   query1.Active:=false;
  573.   query1.Active:=true;
  574. if(query1.Active=true)then
  575. begin
  576. query1.Close;
  577. query1.SQL.Clear;
  578. query1.SQL.Add('select * from ti_judge where tno like ''232%'' order by tno');
  579. query1.Open;
  580. begin
  581.   if query1.RecordCount<>0 then
  582.   begin
  583.   query1.Last;
  584.   temp:=query1.FieldValues['tno']+1;
  585.   end
  586.   else if query1.RecordCount=0 then
  587.   begin
  588.      temp:=2321;
  589.   end;
  590. end;
  591.  end;
  592.  end;
  593.  //-------------------------------------------------------------
  594.  {
  595. if TreeView1.Selected.text='第三章 顺序结构' then
  596.    begin
  597.   query1.Active:=false;
  598.   query1.Active:=true;
  599. if(query1.Active=true)then
  600. begin
  601. query1.Close;
  602. query1.SQL.Clear;
  603. query1.SQL.Add('select * from ti_choose where tno like ''3%%%''');
  604. query1.Open;
  605.  end;
  606.  end;
  607. if TreeView1.Selected.text='第一节' then
  608.    begin
  609.   query1.Active:=false;
  610.   query1.Active:=true;
  611. if(query1.Active=true)then
  612. begin
  613. query1.Close;
  614. query1.SQL.Clear;
  615. query1.SQL.Add('select * from ti_choose where tno like ''31%%''');
  616. query1.Open;
  617.  end;
  618. end;                         }
  619. if TreeView1.Selected.text='第一知识点 字符数据的输入输出' then
  620.    begin
  621.   query1.Active:=false;
  622.   query1.Active:=true;
  623. if(query1.Active=true)then
  624. begin
  625. query1.Close;
  626. query1.SQL.Clear;
  627. query1.SQL.Add('select * from ti_judge where tno like ''311%'' order by tno');
  628. query1.Open;
  629. begin
  630.   if query1.RecordCount<>0 then
  631.   begin
  632.   query1.Last;
  633.   temp:=query1.FieldValues['tno']+1;
  634.   end
  635.   else if query1.RecordCount=0 then
  636.   begin
  637.      temp:=3111;
  638.   end;
  639. end;
  640.  end;
  641.  end;
  642.  {
  643. if TreeView1.Selected.text='第二节' then
  644.    begin
  645.   query1.Active:=false;
  646.   query1.Active:=true;
  647. if(query1.Active=true)then
  648. begin
  649. query1.Close;
  650. query1.SQL.Clear;
  651. query1.SQL.Add('select * from ti_choose where tno like ''32%%''');
  652. query1.Open;
  653.  end;
  654. end;                         }
  655. if TreeView1.Selected.text='第一知识点 格式输入与输出' then
  656.    begin
  657.   query1.Active:=false;
  658.   query1.Active:=true;
  659. if(query1.Active=true)then
  660. begin
  661. query1.Close;
  662. query1.SQL.Clear;
  663. query1.SQL.Add('select * from ti_judge where tno like ''321%'' order by tno');
  664. query1.Open;
  665. begin
  666.   if query1.RecordCount<>0 then
  667.   begin
  668.   query1.Last;
  669.   temp:=query1.FieldValues['tno']+1;
  670.   end
  671.   else if query1.RecordCount=0 then
  672.   begin
  673.      temp:=3211;
  674.   end;
  675. end;
  676.  end;
  677.  end;
  678.  //------------------------------------------------------------
  679.  {
  680. if TreeView1.Selected.text='第四章 选择结构 ' then
  681.    begin
  682.   query1.Active:=false;
  683.   query1.Active:=true;
  684. if(query1.Active=true)then
  685. begin
  686. query1.Close;
  687. query1.SQL.Clear;
  688. query1.SQL.Add('select * from ti_choose where tno like ''4%%%''');
  689. query1.Open;
  690.  end;
  691.  end;
  692.                         }
  693.               {
  694. if TreeView1.Selected.text='第一节' then
  695.    begin
  696.   query1.Active:=false;
  697.   query1.Active:=true;
  698. if(query1.Active=true)then
  699. begin
  700. query1.Close;
  701. query1.SQL.Clear;
  702. query1.SQL.Add('select * from ti_choose where tno like ''41%%''');
  703. query1.Open;
  704.  end;
  705. end;
  706.                       }
  707. if TreeView1.Selected.text='第一知识点 if语句' then
  708.    begin
  709.   query1.Active:=false;
  710.   query1.Active:=true;
  711. if(query1.Active=true)then
  712. begin
  713. query1.Close;
  714. query1.SQL.Clear;
  715. query1.SQL.Add('select * from ti_judge where tno like ''411%'' order by tno');
  716. query1.Open;
  717. begin
  718.   if query1.RecordCount<>0 then
  719.   begin
  720.   query1.Last;
  721.   temp:=query1.FieldValues['tno']+1;
  722.   end
  723.   else if query1.RecordCount=0 then
  724.   begin
  725.      temp:=4111;
  726.   end;
  727. end;
  728.  end;
  729.  end;
  730.  {
  731. if TreeView1.Selected.text='第二节' then
  732.    begin
  733.   query1.Active:=false;
  734.   query1.Active:=true;
  735. if(query1.Active=true)then
  736. begin
  737. query1.Close;
  738. query1.SQL.Clear;
  739. query1.SQL.Add('select * from ti_choose where tno like ''42%%''');
  740. query1.Open;
  741.  end;
  742. end;
  743.                             }
  744. if TreeView1.Selected.text='第一知识点 条件表达式' then
  745.    begin
  746.   query1.Active:=false;
  747.   query1.Active:=true;
  748. if(query1.Active=true)then
  749. begin
  750. query1.Close;
  751. query1.SQL.Clear;
  752. query1.SQL.Add('select * from ti_judge where tno like ''421%'' order by tno');
  753. query1.Open;
  754. begin
  755.   if query1.RecordCount<>0 then
  756.   begin
  757.   query1.Last;
  758.   temp:=query1.FieldValues['tno']+1;
  759.   end
  760.   else if query1.RecordCount=0 then
  761.   begin
  762.      temp:=4211;
  763.   end;
  764. end;
  765.  end;
  766.  end;
  767.  {
  768. if TreeView1.Selected.text='第三节' then
  769.    begin
  770.   query1.Active:=false;
  771.   query1.Active:=true;
  772. if(query1.Active=true)then
  773. begin
  774. query1.Close;
  775. query1.SQL.Clear;
  776. query1.SQL.Add('select * from ti_choose where tno like ''43%%''');
  777. query1.Open;
  778.  end;
  779. end;
  780.                            }
  781. if TreeView1.Selected.text='第一知识点 switch(开关)语句' then
  782.    begin
  783.   query1.Active:=false;
  784.   query1.Active:=true;
  785. if(query1.Active=true)then
  786. begin
  787. query1.Close;
  788. query1.SQL.Clear;
  789. query1.SQL.Add('select * from ti_judge where tno like ''431%'' order by tno');
  790. query1.Open;
  791. begin
  792.   if query1.RecordCount<>0 then
  793.   begin
  794.   query1.Last;
  795.   temp:=query1.FieldValues['tno']+1;
  796.   end
  797.   else if query1.RecordCount=0 then
  798.   begin
  799.      temp:=4311;
  800.   end;
  801. end;
  802.  end;
  803.  end;
  804.  //-------------------------------------------------------
  805.  {
  806. if TreeView1.Selected.text='第五章 循环控制  ' then
  807.    begin
  808.   query1.Active:=false;
  809.   query1.Active:=true;
  810. if(query1.Active=true)then
  811. begin
  812. query1.Close;
  813. query1.SQL.Clear;
  814. query1.SQL.Add('select * from ti_choose where tno like ''5%%%''');
  815. query1.Open;
  816.  end;
  817.  end;
  818. if TreeView1.Selected.text='第一节' then
  819.    begin
  820.   query1.Active:=false;
  821.   query1.Active:=true;
  822. if(query1.Active=true)then
  823. begin
  824. query1.Close;
  825. query1.SQL.Clear;
  826. query1.SQL.Add('select * from ti_choose where tno like ''51%%''');
  827. query1.Open;
  828.  end;
  829. end;
  830.                          }
  831. if TreeView1.Selected.text='第一知识点 while循环语句' then
  832.    begin
  833.   query1.Active:=false;
  834.   query1.Active:=true;
  835. if(query1.Active=true)then
  836. begin
  837. query1.Close;
  838. query1.SQL.Clear;
  839. query1.SQL.Add('select * from ti_judge where tno like ''511%'' order by tno');
  840. query1.Open;
  841. begin
  842.   if query1.RecordCount<>0 then
  843.   begin
  844.   query1.Last;
  845.   temp:=query1.FieldValues['tno']+1;
  846.   end
  847.   else if query1.RecordCount=0 then
  848.   begin
  849.      temp:=5111;
  850.   end;
  851. end;
  852.  end;
  853.  end;
  854. if TreeView1.Selected.text='第二知识点 do-while循环语句' then
  855.    begin
  856.   query1.Active:=false;
  857.   query1.Active:=true;
  858. if(query1.Active=true)then
  859. begin
  860. query1.Close;
  861. query1.SQL.Clear;
  862. query1.SQL.Add('select * from ti_judge where tno like ''512%'' order by tno');
  863. query1.Open;
  864. begin
  865.   if query1.RecordCount<>0 then
  866.   begin
  867.   query1.Last;
  868.   temp:=query1.FieldValues['tno']+1;
  869.   end
  870.   else if query1.RecordCount=0 then
  871.   begin
  872.      temp:=5121;
  873.   end;
  874. end;
  875.  end;
  876.  end;
  877.  {
  878. if TreeView1.Selected.text='第二节' then
  879.    begin
  880.   query1.Active:=false;
  881.   query1.Active:=true;
  882. if(query1.Active=true)then
  883. begin
  884. query1.Close;
  885. query1.SQL.Clear;
  886. query1.SQL.Add('select * from ti_choose where tno like ''52%%''');
  887. query1.Open;
  888.  end;
  889. end;
  890.                       }
  891. if TreeView1.Selected.text='第一知识点 for循环语句' then
  892.    begin
  893.   query1.Active:=false;
  894.   query1.Active:=true;
  895. if(query1.Active=true)then
  896. begin
  897. query1.Close;
  898. query1.SQL.Clear;
  899. query1.SQL.Add('select * from ti_judge where tno like ''521%'' order by tno');
  900. query1.Open;
  901. begin
  902.   if query1.RecordCount<>0 then
  903.   begin
  904.   query1.Last;
  905.   temp:=query1.FieldValues['tno']+1;
  906.   end
  907.   else if query1.RecordCount=0 then
  908.   begin
  909.      temp:=5211;
  910.   end;
  911. end;
  912.  end;
  913.  end;
  914.                       {
  915. if TreeView1.Selected.text='第三节' then
  916.    begin
  917.   query1.Active:=false;
  918.   query1.Active:=true;
  919. if(query1.Active=true)then
  920. begin
  921. query1.Close;
  922. query1.SQL.Clear;
  923. query1.SQL.Add('select * from ti_choose where tno like ''53%%''');
  924. query1.Open;
  925.  end;
  926. end;                  }
  927. if TreeView1.Selected.text='第一知识点 break语句' then
  928.    begin
  929.   query1.Active:=false;
  930.   query1.Active:=true;
  931. if(query1.Active=true)then
  932. begin
  933. query1.Close;
  934. query1.SQL.Clear;
  935. query1.SQL.Add('select * from ti_judge where tno like ''531%'' order by tno');
  936. query1.Open;
  937. begin
  938.   if query1.RecordCount<>0 then
  939.   begin
  940.   query1.Last;
  941.   temp:=query1.FieldValues['tno']+1;
  942.   end
  943.   else if query1.RecordCount=0 then
  944.   begin
  945.      temp:=5311;
  946.   end;
  947. end;
  948.  end;
  949.  end;
  950. if TreeView1.Selected.text='第二知识点 continue语句' then
  951.    begin
  952.   query1.Active:=false;
  953.   query1.Active:=true;
  954. if(query1.Active=true)then
  955. begin
  956. query1.Close;
  957. query1.SQL.Clear;
  958. query1.SQL.Add('select * from ti_judge where tno like ''532%'' order by tno');
  959. query1.Open;
  960. begin
  961.   if query1.RecordCount<>0 then
  962.   begin
  963.   query1.Last;
  964.   temp:=query1.FieldValues['tno']+1;
  965.   end
  966.   else if query1.RecordCount=0 then
  967.   begin
  968.      temp:=5321;
  969.   end;
  970. end;
  971.  end;
  972.  end;
  973.  {
  974. if TreeView1.Selected.text='第四节' then
  975.    begin
  976.   query1.Active:=false;
  977.   query1.Active:=true;
  978. if(query1.Active=true)then
  979. begin
  980. query1.Close;
  981. query1.SQL.Clear;
  982. query1.SQL.Add('select * from ti_filltext where tno like ''54%%''');
  983. query1.Open;
  984.  end;
  985. end;                }
  986. if TreeView1.Selected.text='第一知识点 goto语句' then
  987.    begin
  988.   query1.Active:=false;
  989.   query1.Active:=true;
  990. if(query1.Active=true)then
  991. begin
  992. query1.Close;
  993. query1.SQL.Clear;
  994. query1.SQL.Add('select * from ti_judge where tno like ''541%'' order by tno');
  995. query1.Open;
  996. begin
  997.   if query1.RecordCount<>0 then
  998.   begin
  999.   query1.Last;
  1000.   temp:=query1.FieldValues['tno']+1;
  1001.   end
  1002.   else if query1.RecordCount=0 then
  1003.   begin
  1004.      temp:=5411;
  1005.   end;
  1006. end;
  1007.  end;
  1008.  end;
  1009.  //-----------------------------------------------------
  1010.  {
  1011. if TreeView1.Selected.text='第六章 数组指针  ' then
  1012.    begin
  1013.   query1.Active:=false;
  1014.   query1.Active:=true;
  1015. if(query1.Active=true)then
  1016. begin
  1017. query1.Close;
  1018. query1.SQL.Clear;
  1019. query1.SQL.Add('select * from ti_choose where tno like ''6%%%''');
  1020. query1.Open;
  1021.  end;
  1022.  end;
  1023. if TreeView1.Selected.text='第一节' then
  1024.    begin
  1025.   query1.Active:=false;
  1026.   query1.Active:=true;
  1027. if(query1.Active=true)then
  1028. begin
  1029. query1.Close;
  1030. query1.SQL.Clear;
  1031. query1.SQL.Add('select * from ti_choose where tno like ''61%%''');
  1032. query1.Open;
  1033.  end;
  1034. end;                  }
  1035. if TreeView1.Selected.text='第一知识点 一维数组' then
  1036.    begin
  1037.   query1.Active:=false;
  1038.   query1.Active:=true;
  1039. if(query1.Active=true)then
  1040. begin
  1041. query1.Close;
  1042. query1.SQL.Clear;
  1043. query1.SQL.Add('select * from ti_judge where tno like ''611%'' order by tno');
  1044. query1.Open;
  1045. begin
  1046.   if query1.RecordCount<>0 then
  1047.   begin
  1048.   query1.Last;
  1049.   temp:=query1.FieldValues['tno']+1;
  1050.   end
  1051.   else if query1.RecordCount=0 then
  1052.   begin
  1053.      temp:=6111;
  1054.   end;
  1055. end;
  1056.  end;
  1057.  end;
  1058. if TreeView1.Selected.text='第二知识点 二维数组' then
  1059.    begin
  1060.   query1.Active:=false;
  1061.   query1.Active:=true;
  1062. if(query1.Active=true)then
  1063. begin
  1064. query1.Close;
  1065. query1.SQL.Clear;
  1066. query1.SQL.Add('select * from ti_judge where tno like ''612%'' order by tno');
  1067. query1.Open;
  1068. begin
  1069.   if query1.RecordCount<>0 then
  1070.   begin
  1071.   query1.Last;
  1072.   temp:=query1.FieldValues['tno']+1;
  1073.   end
  1074.   else if query1.RecordCount=0 then
  1075.   begin
  1076.      temp:=6121;
  1077.   end;
  1078. end;
  1079.  end;
  1080.  end;
  1081. if TreeView1.Selected.text='第三知识点 字符数组' then
  1082.    begin
  1083.   query1.Active:=false;
  1084.   query1.Active:=true;
  1085. if(query1.Active=true)then
  1086. begin
  1087. query1.Close;
  1088. query1.SQL.Clear;
  1089. query1.SQL.Add('select * from ti_judge where tno like ''613%'' order by tno');
  1090. query1.Open;
  1091. begin
  1092.   if query1.RecordCount<>0 then
  1093.   begin
  1094.   query1.Last;
  1095.   temp:=query1.FieldValues['tno']+1;
  1096.   end
  1097.   else if query1.RecordCount=0 then
  1098.   begin
  1099.      temp:=6131;
  1100.   end;
  1101. end;
  1102.  end;
  1103.  end;
  1104.  {
  1105. if TreeView1.Selected.text='第二节' then
  1106.    begin
  1107.   query1.Active:=false;
  1108.   query1.Active:=true;
  1109. if(query1.Active=true)then
  1110. begin
  1111. query1.Close;
  1112. query1.SQL.Clear;
  1113. query1.SQL.Add('select * from ti_choose where tno like ''62%%''');
  1114. query1.Open;
  1115.  end;
  1116. end;                    }
  1117. if TreeView1.Selected.text='第一知识点 指针的说明和初始化' then
  1118.    begin
  1119.   query1.Active:=false;
  1120.   query1.Active:=true;
  1121. if(query1.Active=true)then
  1122. begin
  1123. query1.Close;
  1124. query1.SQL.Clear;
  1125. query1.SQL.Add('select * from ti_judge where tno like ''621%'' order by tno');
  1126. query1.Open;
  1127. begin
  1128.   if query1.RecordCount<>0 then
  1129.   begin
  1130.   query1.Last;
  1131.   temp:=query1.FieldValues['tno']+1;
  1132.   end
  1133.   else if query1.RecordCount=0 then
  1134.   begin
  1135.      temp:=6211;
  1136.   end;
  1137. end;
  1138.  end;
  1139.  end;
  1140. if TreeView1.Selected.text='第二知识点 指针运算' then
  1141.    begin
  1142.   query1.Active:=false;
  1143.   query1.Active:=true;
  1144. if(query1.Active=true)then
  1145. begin
  1146. query1.Close;
  1147. query1.SQL.Clear;
  1148. query1.SQL.Add('select * from ti_judge where tno like ''622%'' order by tno');
  1149. query1.Open;
  1150. begin
  1151.   if query1.RecordCount<>0 then
  1152.   begin
  1153.   query1.Last;
  1154.   temp:=query1.FieldValues['tno']+1;
  1155.   end
  1156.   else if query1.RecordCount=0 then
  1157.   begin
  1158.      temp:=6221;
  1159.   end;
  1160. end;
  1161.  end;
  1162.  end;
  1163. if TreeView1.Selected.text='第三知识点 一维数组和运算' then
  1164.    begin
  1165.   query1.Active:=false;
  1166.   query1.Active:=true;
  1167. if(query1.Active=true)then
  1168. begin
  1169. query1.Close;
  1170. query1.SQL.Clear;
  1171. query1.SQL.Add('select * from ti_judge where tno like ''623%'' order by tno');
  1172. query1.Open;
  1173. begin
  1174.   if query1.RecordCount<>0 then
  1175.   begin
  1176.   query1.Last;
  1177.   temp:=query1.FieldValues['tno']+1;
  1178.   end
  1179.   else if query1.RecordCount=0 then
  1180.   begin
  1181.      temp:=6231;
  1182.   end;
  1183. end;
  1184.  end;
  1185.  end;
  1186. if TreeView1.Selected.text='第四知识点 二维数组和运算' then
  1187.    begin
  1188.   query1.Active:=false;
  1189.   query1.Active:=true;
  1190. if(query1.Active=true)then
  1191. begin
  1192. query1.Close;
  1193. query1.SQL.Clear;
  1194. query1.SQL.Add('select * from ti_judge where tno like ''624%'' order by tno');
  1195. query1.Open;
  1196. begin
  1197.   if query1.RecordCount<>0 then
  1198.   begin
  1199.   query1.Last;
  1200.   temp:=query1.FieldValues['tno']+1;
  1201.   end
  1202.   else if query1.RecordCount=0 then
  1203.   begin
  1204.      temp:=6241;
  1205.   end;
  1206. end;
  1207.  end;
  1208.  end;
  1209. if TreeView1.Selected.text='第五知识点 字符指针和字符串' then
  1210.    begin
  1211.   query1.Active:=false;
  1212.   query1.Active:=true;
  1213. if(query1.Active=true)then
  1214. begin
  1215. query1.Close;
  1216. query1.SQL.Clear;
  1217. query1.SQL.Add('select * from ti_judge where tno like ''625%'' order by tno');
  1218. query1.Open;
  1219. begin
  1220.   if query1.RecordCount<>0 then
  1221.   begin
  1222.   query1.Last;
  1223.   temp:=query1.FieldValues['tno']+1;
  1224.   end
  1225.   else if query1.RecordCount=0 then
  1226.   begin
  1227.      temp:=6251;
  1228.   end;
  1229. end;
  1230. ;
  1231.  end;
  1232.  end;
  1233. if TreeView1.Selected.text='第六知识点 多级指针' then
  1234.    begin
  1235.   query1.Active:=false;
  1236.   query1.Active:=true;
  1237. if(query1.Active=true)then
  1238. begin
  1239. query1.Close;
  1240. query1.SQL.Clear;
  1241. query1.SQL.Add('select * from ti_judge where tno like ''626%'' order by tno');
  1242. query1.Open;
  1243. begin
  1244.   if query1.RecordCount<>0 then
  1245.   begin
  1246.   query1.Last;
  1247.   temp:=query1.FieldValues['tno']+1;
  1248.   end
  1249.   else if query1.RecordCount=0 then
  1250.   begin
  1251.      temp:=6261;
  1252.   end;
  1253. end;
  1254.  end;
  1255.  end;
  1256. if TreeView1.Selected.text='第七知识点 指针型函数' then
  1257.    begin
  1258.   query1.Active:=false;
  1259.   query1.Active:=true;
  1260. if(query1.Active=true)then
  1261. begin
  1262. query1.Close;
  1263. query1.SQL.Clear;
  1264. query1.SQL.Add('select * from ti_judge where tno like ''627%'' order by tno');
  1265. query1.Open;
  1266. begin
  1267.   if query1.RecordCount<>0 then
  1268.   begin
  1269.   query1.Last;
  1270.   temp:=query1.FieldValues['tno']+1;
  1271.   end
  1272.   else if query1.RecordCount=0 then
  1273.   begin
  1274.      temp:=6271;
  1275.   end;
  1276. end;
  1277.  end;
  1278.  end;
  1279. if TreeView1.Selected.text='第八知识点 指向函数的指针' then
  1280.    begin
  1281.   query1.Active:=false;
  1282.   query1.Active:=true;
  1283. if(query1.Active=true)then
  1284. begin
  1285. query1.Close;
  1286. query1.SQL.Clear;
  1287. query1.SQL.Add('select * from ti_judge where tno like ''628%'' order by tno');
  1288. query1.Open;
  1289. begin
  1290.   if query1.RecordCount<>0 then
  1291.   begin
  1292.   query1.Last;
  1293.   temp:=query1.FieldValues['tno']+1;
  1294.   end
  1295.   else if query1.RecordCount=0 then
  1296.   begin
  1297.      temp:=6281;
  1298.   end;
  1299. end;
  1300.  end;
  1301.  end;
  1302.                   {
  1303. if TreeView1.Selected.text='第七章 函数  结构体与共用体  ' then
  1304.    begin
  1305.   query1.Active:=false;
  1306.   query1.Active:=true;
  1307. if(query1.Active=true)then
  1308. begin
  1309. query1.Close;
  1310. query1.SQL.Clear;
  1311. query1.SQL.Add('select * from ti_choose where tno like ''7%%%''');
  1312. query1.Open;
  1313.  end;
  1314.  end;
  1315. if TreeView1.Selected.text='第一节 ' then
  1316.    begin
  1317.   query1.Active:=false;
  1318.   query1.Active:=true;
  1319. if(query1.Active=true)then
  1320. begin
  1321. query1.Close;
  1322. query1.SQL.Clear;
  1323. query1.SQL.Add('select * from ti_choose where tno like ''71%%''');
  1324. query1.Open;
  1325.  end;
  1326. end;                 }
  1327. if TreeView1.Selected.text='第一知识点 函数设计' then
  1328.    begin
  1329.   query1.Active:=false;
  1330.   query1.Active:=true;
  1331. if(query1.Active=true)then
  1332. begin
  1333. query1.Close;
  1334. query1.SQL.Clear;
  1335. query1.SQL.Add('select * from ti_judge where tno like ''711%'' order by tno');
  1336. query1.Open;
  1337. begin
  1338.   if query1.RecordCount<>0 then
  1339.   begin
  1340.   query1.Last;
  1341.   temp:=query1.FieldValues['tno']+1;
  1342.   end
  1343.   else if query1.RecordCount=0 then
  1344.   begin
  1345.      temp:=7111;
  1346.   end;
  1347. end;
  1348.  end;
  1349.  end;
  1350. if TreeView1.Selected.text='第二知识点 函数的存储类型' then
  1351.    begin
  1352.   query1.Active:=false;
  1353.   query1.Active:=true;
  1354. if(query1.Active=true)then
  1355. begin
  1356. query1.Close;
  1357. query1.SQL.Clear;
  1358. query1.SQL.Add('select * from ti_judge where tno like ''712%'' order by tno');
  1359. query1.Open;
  1360. begin
  1361.   if query1.RecordCount<>0 then
  1362.   begin
  1363.   query1.Last;
  1364.   temp:=query1.FieldValues['tno']+1;
  1365.   end
  1366.   else if query1.RecordCount=0 then
  1367.   begin
  1368.      temp:=7121;
  1369.   end;
  1370. end;
  1371.  end;
  1372.  end;
  1373. if TreeView1.Selected.text='第三知识点 变量的作用域和存储类型' then
  1374.    begin
  1375.   query1.Active:=false;
  1376.   query1.Active:=true;
  1377. if(query1.Active=true)then
  1378. begin
  1379. query1.Close;
  1380. query1.SQL.Clear;
  1381. query1.SQL.Add('select * from ti_judge where tno like ''713%'' order by tno');
  1382. query1.Open;
  1383. begin
  1384.   if query1.RecordCount<>0 then
  1385.   begin
  1386.   query1.Last;
  1387.   temp:=query1.FieldValues['tno']+1;
  1388.   end
  1389.   else if query1.RecordCount=0 then
  1390.   begin
  1391.      temp:=7131;
  1392.   end;
  1393. end;
  1394.  end;
  1395.  end;
  1396. if TreeView1.Selected.text='第四知识点 函数的数据传递' then
  1397.    begin
  1398.   query1.Active:=false;
  1399.   query1.Active:=true;
  1400. if(query1.Active=true)then
  1401. begin
  1402. query1.Close;
  1403. query1.SQL.Clear;
  1404. query1.SQL.Add('select * from ti_judge where tno like ''714%'' order by tno');
  1405. query1.Open;
  1406. begin
  1407.   if query1.RecordCount<>0 then
  1408.   begin
  1409.   query1.Last;
  1410.   temp:=query1.FieldValues['tno']+1;
  1411.   end
  1412.   else if query1.RecordCount=0 then
  1413.   begin
  1414.      temp:=7141;
  1415.   end;
  1416. end;
  1417.  end;
  1418.  end;
  1419. if TreeView1.Selected.text='第五知识点 数组在函数间的传递' then
  1420.    begin
  1421.   query1.Active:=false;
  1422.   query1.Active:=true;
  1423. if(query1.Active=true)then
  1424. begin
  1425. query1.Close;
  1426. query1.SQL.Clear;
  1427. query1.SQL.Add('select * from ti_judge where tno like ''715%'' order by tno');
  1428. query1.Open;
  1429. begin
  1430.   if query1.RecordCount<>0 then
  1431.   begin
  1432.   query1.Last;
  1433.   temp:=query1.FieldValues['tno']+1;
  1434.   end
  1435.   else if query1.RecordCount=0 then
  1436.   begin
  1437.      temp:=7151;
  1438.   end;
  1439. end;
  1440.  end;
  1441.  end;
  1442. if TreeView1.Selected.text='第六知识点 递归函数' then
  1443.    begin
  1444.   query1.Active:=false;
  1445.   query1.Active:=true;
  1446. if(query1.Active=true)then
  1447. begin
  1448. query1.Close;
  1449. query1.SQL.Clear;
  1450. query1.SQL.Add('select * from ti_judge where tno like ''716%'' order by tno');
  1451. query1.Open;
  1452. begin
  1453.   if query1.RecordCount<>0 then
  1454.   begin
  1455.   query1.Last;
  1456.   temp:=query1.FieldValues['tno']+1;
  1457.   end
  1458.   else if query1.RecordCount=0 then
  1459.   begin
  1460.      temp:=7161;
  1461.   end;
  1462. end;
  1463.  end;
  1464.  end;
  1465. if TreeView1.Selected.text='第七知识点 传递main()函数的参数' then
  1466.    begin
  1467.   query1.Active:=false;
  1468.   query1.Active:=true;
  1469. if(query1.Active=true)then
  1470. begin
  1471. query1.Close;
  1472. query1.SQL.Clear;
  1473. query1.SQL.Add('select * from ti_judge where tno like ''717%'' order by tno');
  1474. query1.Open;
  1475. begin
  1476.   if query1.RecordCount<>0 then
  1477.   begin
  1478.   query1.Last;
  1479.   temp:=query1.FieldValues['tno']+1;
  1480.   end
  1481.   else if query1.RecordCount=0 then
  1482.   begin
  1483.      temp:=7171;
  1484.   end;
  1485. end;
  1486.  end;
  1487.  end;
  1488.  {
  1489. if TreeView1.Selected.text='第二节 ' then
  1490.    begin
  1491.   query1.Active:=false;
  1492.   query1.Active:=true;
  1493. if(query1.Active=true)then
  1494. begin
  1495. query1.Close;
  1496. query1.SQL.Clear;
  1497. query1.SQL.Add('select * from ti_choose where tno like ''72%%''');
  1498. query1.Open;
  1499.  end;
  1500. end;                             }
  1501. if TreeView1.Selected.text='第一知识点 结构体定义和变量说明' then
  1502.    begin
  1503.   query1.Active:=false;
  1504.   query1.Active:=true;
  1505. if(query1.Active=true)then
  1506. begin
  1507. query1.Close;
  1508. query1.SQL.Clear;
  1509. query1.SQL.Add('select * from ti_judge where tno like ''721%'' order by tno');
  1510. query1.Open;
  1511. begin
  1512.   if query1.RecordCount<>0 then
  1513.   begin
  1514.   query1.Last;
  1515.   temp:=query1.FieldValues['tno']+1;
  1516.   end
  1517.   else if query1.RecordCount=0 then
  1518.   begin
  1519.      temp:=7211;
  1520.   end;
  1521. end;
  1522.  end;
  1523.  end;
  1524. if TreeView1.Selected.text='第二知识点 结构体变量的引用和初始化' then
  1525.    begin
  1526.   query1.Active:=false;
  1527.   query1.Active:=true;
  1528. if(query1.Active=true)then
  1529. begin
  1530. query1.Close;
  1531. query1.SQL.Clear;
  1532. query1.SQL.Add('select * from ti_judge where tno like ''722%'' order by tno');
  1533. query1.Open;
  1534. begin
  1535.   if query1.RecordCount<>0 then
  1536.   begin
  1537.   query1.Last;
  1538.   temp:=query1.FieldValues['tno']+1;
  1539.   end
  1540.   else if query1.RecordCount=0 then
  1541.   begin
  1542.      temp:=7221;
  1543.   end;
  1544. end;
  1545.  end;
  1546.  end;
  1547. if TreeView1.Selected.text='第三知识点 结构体数组' then
  1548.    begin
  1549.   query1.Active:=false;
  1550.   query1.Active:=true;
  1551. if(query1.Active=true)then
  1552. begin
  1553. query1.Close;
  1554. query1.SQL.Clear;
  1555. query1.SQL.Add('select * from ti_judge where tno like ''723%'' order by tno');
  1556. query1.Open;
  1557. begin
  1558.   if query1.RecordCount<>0 then
  1559.   begin
  1560.   query1.Last;
  1561.   temp:=query1.FieldValues['tno']+1;
  1562.   end
  1563.   else if query1.RecordCount=0 then
  1564.   begin
  1565.      temp:=7231;
  1566.   end;
  1567. end;
  1568.  end;
  1569.  end;
  1570. if TreeView1.Selected.text='第四知识点 结构体指针' then
  1571.    begin
  1572.   query1.Active:=false;
  1573.   query1.Active:=true;
  1574. if(query1.Active=true)then
  1575. begin
  1576. query1.Close;
  1577. query1.SQL.Clear;
  1578. query1.SQL.Add('select * from ti_judge where tno like ''724%'' order by tno');
  1579. query1.Open;
  1580. begin
  1581.   if query1.RecordCount<>0 then
  1582.   begin
  1583.   query1.Last;
  1584.   temp:=query1.FieldValues['tno']+1;
  1585.   end
  1586.   else if query1.RecordCount=0 then
  1587.   begin
  1588.      temp:=7241;
  1589.   end;
  1590. end;
  1591.  end;
  1592.  end;
  1593. if TreeView1.Selected.text='第五知识点 函数之间结构体变量的数据传递' then
  1594.    begin
  1595.   query1.Active:=false;
  1596.   query1.Active:=true;
  1597. if(query1.Active=true)then
  1598. begin
  1599. query1.Close;
  1600. query1.SQL.Clear;
  1601. query1.SQL.Add('select * from ti_judge where tno like ''725%'' order by tno');
  1602. query1.Open;
  1603. begin
  1604.   if query1.RecordCount<>0 then
  1605.   begin
  1606.   query1.Last;
  1607.   temp:=query1.FieldValues['tno']+1;
  1608.   end
  1609.   else if query1.RecordCount=0 then
  1610.   begin
  1611.      temp:=7251;
  1612.   end;
  1613. end;
  1614.  end;
  1615.  end;
  1616. if TreeView1.Selected.text='第六知识点 结构体嵌套' then
  1617.    begin
  1618.   query1.Active:=false;
  1619.   query1.Active:=true;
  1620. if(query1.Active=true)then
  1621. begin
  1622. query1.Close;
  1623. query1.SQL.Clear;
  1624. query1.SQL.Add('select * from ti_judge where tno like ''726%'' order by tno');
  1625. query1.Open;
  1626. begin
  1627.   if query1.RecordCount<>0 then
  1628.   begin
  1629.   query1.Last;
  1630.   temp:=query1.FieldValues['tno']+1;
  1631.   end
  1632.   else if query1.RecordCount=0 then
  1633.   begin
  1634.      temp:=7261;
  1635.   end;
  1636. end;
  1637. ;
  1638.  end;
  1639.  end;
  1640. if TreeView1.Selected.text='第七知识点 链表' then
  1641.    begin
  1642.   query1.Active:=false;
  1643.   query1.Active:=true;
  1644. if(query1.Active=true)then
  1645. begin
  1646. query1.Close;
  1647. query1.SQL.Clear;
  1648. query1.SQL.Add('select * from ti_judge where tno like ''727%'' order by tno');
  1649. query1.Open;
  1650. begin
  1651.   if query1.RecordCount<>0 then
  1652.   begin
  1653.   query1.Last;
  1654.   temp:=query1.FieldValues['tno']+1;
  1655.   end
  1656.   else if query1.RecordCount=0 then
  1657.   begin
  1658.      temp:=7271;
  1659.   end;
  1660. end;
  1661.  end;
  1662.  end;
  1663. if TreeView1.Selected.text='第八知识点 共用体' then
  1664.    begin
  1665.   query1.Active:=false;
  1666.   query1.Active:=true;
  1667. if(query1.Active=true)then
  1668. begin
  1669. query1.Close;
  1670. query1.SQL.Clear;
  1671. query1.SQL.Add('select * from ti_judge where tno like ''728%'' order by tno');
  1672. query1.Open;
  1673. begin
  1674.   if query1.RecordCount<>0 then
  1675.   begin
  1676.   query1.Last;
  1677.   temp:=query1.FieldValues['tno']+1;
  1678.   end
  1679.   else if query1.RecordCount=0 then
  1680.   begin
  1681.      temp:=7281;
  1682.   end;
  1683. end;
  1684.  end;
  1685.  end;
  1686. if TreeView1.Selected.text='第九知识点 枚举类型' then
  1687.    begin
  1688.   query1.Active:=false;
  1689.   query1.Active:=true;
  1690. if(query1.Active=true)then
  1691. begin
  1692. query1.Close;
  1693. query1.SQL.Clear;
  1694. query1.SQL.Add('select * from ti_judge where tno like ''729%'' order by tno');
  1695. query1.Open;
  1696. begin
  1697.   if query1.RecordCount<>0 then
  1698.   begin
  1699.   query1.Last;
  1700.   temp:=query1.FieldValues['tno']+1;
  1701.   end
  1702.   else if query1.RecordCount=0 then
  1703.   begin
  1704.      temp:=7291;
  1705.   end;
  1706. end;
  1707.  end;
  1708.  end;
  1709.  {
  1710. if TreeView1.Selected.text='第八章 预处理命令  ' then
  1711.    begin
  1712.   query1.Active:=false;
  1713.   query1.Active:=true;
  1714. if(query1.Active=true)then
  1715. begin
  1716. query1.Close;
  1717. query1.SQL.Clear;
  1718. query1.SQL.Add('select * from ti_choose where tno like ''8%%%''');
  1719. query1.Open;
  1720.  end;
  1721.  end;
  1722. if TreeView1.Selected.text='第一节 ' then
  1723.    begin
  1724.   query1.Active:=false;
  1725.   query1.Active:=true;
  1726. if(query1.Active=true)then
  1727. begin
  1728. query1.Close;
  1729. query1.SQL.Clear;
  1730. query1.SQL.Add('select * from ti_choose where tno like ''81%%''');
  1731. query1.Open;
  1732.  end;
  1733. end;                                }
  1734. if TreeView1.Selected.text='第一知识点 宏' then
  1735.    begin
  1736.   query1.Active:=false;
  1737.   query1.Active:=true;
  1738. if(query1.Active=true)then
  1739. begin
  1740. query1.Close;
  1741. query1.SQL.Clear;
  1742. query1.SQL.Add('select * from ti_judge where tno like ''811%'' order by tno');
  1743. query1.Open;
  1744. begin
  1745.   if query1.RecordCount<>0 then
  1746.   begin
  1747.   query1.Last;
  1748.   temp:=query1.FieldValues['tno']+1;
  1749.   end
  1750.   else if query1.RecordCount=0 then
  1751.   begin
  1752.      temp:=8111;
  1753.   end;
  1754. end;
  1755.  end;
  1756.  end;
  1757. if TreeView1.Selected.text='第二知识点 条件编译' then
  1758.    begin
  1759.   query1.Active:=false;
  1760.   query1.Active:=true;
  1761. if(query1.Active=true)then
  1762. begin
  1763. query1.Close;
  1764. query1.SQL.Clear;
  1765. query1.SQL.Add('select * from ti_judge where tno like ''812%'' order by tno');
  1766. query1.Open;
  1767. begin
  1768.   if query1.RecordCount<>0 then
  1769.   begin
  1770.   query1.Last;
  1771.   temp:=query1.FieldValues['tno']+1;
  1772.   end
  1773.   else if query1.RecordCount=0 then
  1774.   begin
  1775.      temp:=8121;
  1776.   end;
  1777. end;
  1778.  end;
  1779.  end;
  1780. if TreeView1.Selected.text='第三知识点 文件包含' then
  1781.    begin
  1782.   query1.Active:=false;
  1783.   query1.Active:=true;
  1784. if(query1.Active=true)then
  1785. begin
  1786. query1.Close;
  1787. query1.SQL.Clear;
  1788. query1.SQL.Add('select * from ti_judge where tno like ''813%'' order by tno');
  1789. query1.Open;
  1790. begin
  1791.   if query1.RecordCount<>0 then
  1792.   begin
  1793.   query1.Last;
  1794.   temp:=query1.FieldValues['tno']+1;
  1795.   end
  1796.   else if query1.RecordCount=0 then
  1797.   begin
  1798.      temp:=8131;
  1799.   end;
  1800. end;
  1801.  end;
  1802.  end;
  1803.  {
  1804. if TreeView1.Selected.text='第二节 ' then
  1805.    begin
  1806.   query1.Active:=false;
  1807.   query1.Active:=true;
  1808. if(query1.Active=true)then
  1809. begin
  1810. query1.Close;
  1811. query1.SQL.Clear;
  1812. query1.SQL.Add('select * from ti_choose where tno like ''82%%''');
  1813. query1.Open;
  1814.  end;
  1815. end;                           }
  1816. if TreeView1.Selected.text='第一知识点 文件概述' then
  1817.    begin
  1818.   query1.Active:=false;
  1819.   query1.Active:=true;
  1820. if(query1.Active=true)then
  1821. begin
  1822. query1.Close;
  1823. query1.SQL.Clear;
  1824. query1.SQL.Add('select * from ti_judge where tno like ''821%'' order by tno');
  1825. query1.Open;
  1826. begin
  1827.   if query1.RecordCount<>0 then
  1828.   begin
  1829.   query1.Last;
  1830.   temp:=query1.FieldValues['tno']+1;
  1831.   end
  1832.   else if query1.RecordCount=0 then
  1833.   begin
  1834.      temp:=8211;
  1835.   end;
  1836. end;
  1837.  end;
  1838.  end;
  1839. if TreeView1.Selected.text='第二知识点 文件的输入输出' then
  1840.    begin
  1841.   query1.Active:=false;
  1842.   query1.Active:=true;
  1843. if(query1.Active=true)then
  1844. begin
  1845. query1.Close;
  1846. query1.SQL.Clear;
  1847. query1.SQL.Add('select * from ti_judge where tno like ''822%'' order by tno');
  1848. query1.Open;
  1849. begin
  1850.   if query1.RecordCount<>0 then
  1851.   begin
  1852.   query1.Last;
  1853.   temp:=query1.FieldValues['tno']+1;
  1854.   end
  1855.   else if query1.RecordCount=0 then
  1856.   begin
  1857.      temp:=8221;
  1858.   end;
  1859. end;
  1860.  end;
  1861.  end;
  1862. if TreeView1.Selected.text='第三知识点 文件的定位操作' then
  1863.    begin
  1864.   query1.Active:=false;
  1865.   query1.Active:=true;
  1866. if(query1.Active=true)then
  1867. begin
  1868. query1.Close;
  1869. query1.SQL.Clear;
  1870. query1.SQL.Add('select * from ti_judge where tno like ''823%'' order by tno');
  1871. query1.Open;
  1872. begin
  1873.   if query1.RecordCount<>0 then
  1874.   begin
  1875.   query1.Last;
  1876.   temp:=query1.FieldValues['tno']+1;
  1877.   end
  1878.   else if query1.RecordCount=0 then
  1879.   begin
  1880.      temp:=8231;
  1881.   end;
  1882. end;
  1883.  end;
  1884.  end;
  1885. if TreeView1.Selected.text='第四知识点 文件的检测' then
  1886.    begin
  1887.   query1.Active:=false;
  1888.   query1.Active:=true;
  1889. if(query1.Active=true)then
  1890. begin
  1891. query1.Close;
  1892. query1.SQL.Clear;
  1893. query1.SQL.Add('select * from ti_judge where tno like ''824%'' order by tno');
  1894. query1.Open;
  1895. begin
  1896.   if query1.RecordCount<>0 then
  1897.   begin
  1898.   query1.Last;
  1899.   temp:=query1.FieldValues['tno']+1;
  1900.   end
  1901.   else if query1.RecordCount=0 then
  1902.   begin
  1903.      temp:=8241;
  1904.   end;
  1905. end;
  1906.  end;
  1907.  end;
  1908.  {
  1909. if TreeView1.Selected.text='第九章 常用算法设计  ' then
  1910.    begin
  1911.   query1.Active:=false;
  1912.   query1.Active:=true;
  1913. if(query1.Active=true)then
  1914. begin
  1915. query1.Close;
  1916. query1.SQL.Clear;
  1917. query1.SQL.Add('select * from ti_choose where tno like ''9%%%''');
  1918. query1.Open;
  1919.  end;
  1920.  end;
  1921. if TreeView1.Selected.text='第一节 ' then
  1922.    begin
  1923.   query1.Active:=false;
  1924.   query1.Active:=true;
  1925. if(query1.Active=true)then
  1926. begin
  1927. query1.Close;
  1928. query1.SQL.Clear;
  1929. query1.SQL.Add('select * from ti_choose where tno like ''91%%''');
  1930. query1.Open;
  1931.  end;
  1932. end;                     }
  1933. if TreeView1.Selected.text='第一知识点 排序' then
  1934.    begin
  1935.   query1.Active:=false;
  1936.   query1.Active:=true;
  1937. if(query1.Active=true)then
  1938. begin
  1939. query1.Close;
  1940. query1.SQL.Clear;
  1941. query1.SQL.Add('select * from ti_judge where tno like ''911%'' order by tno');
  1942. query1.Open;
  1943. begin
  1944.   if query1.RecordCount<>0 then
  1945.   begin
  1946.   query1.Last;
  1947.   temp:=query1.FieldValues['tno']+1;
  1948.   end
  1949.   else if query1.RecordCount=0 then
  1950.   begin
  1951.      temp:=9111;
  1952.   end;
  1953. end;
  1954.  end;
  1955.  end;
  1956.  {
  1957. if TreeView1.Selected.text='第二节 ' then
  1958.    begin
  1959.   query1.Active:=false;
  1960.   query1.Active:=true;
  1961. if(query1.Active=true)then
  1962. begin
  1963. query1.Close;
  1964. query1.SQL.Clear;
  1965. query1.SQL.Add('select * from ti_choose where tno like ''92%%''');
  1966. query1.Open;
  1967.  end;
  1968. end;                               }
  1969. if TreeView1.Selected.text='第一知识点 查找' then
  1970.    begin
  1971.   query1.Active:=false;
  1972.   query1.Active:=true;
  1973. if(query1.Active=true)then
  1974. begin
  1975. query1.Close;
  1976. query1.SQL.Clear;
  1977. query1.SQL.Add('select * from ti_judge where tno like ''921%'' order by tno');
  1978. query1.Open;
  1979. begin
  1980.   if query1.RecordCount<>0 then
  1981.   begin
  1982.   query1.Last;
  1983.   temp:=query1.FieldValues['tno']+1;
  1984.   end
  1985.   else if query1.RecordCount=0 then
  1986.   begin
  1987.      temp:=9211;
  1988.   end;
  1989. end;
  1990.  end;
  1991.  end;
  1992.  {
  1993. if TreeView1.Selected.text='第三节 ' then
  1994.    begin
  1995.   query1.Active:=false;
  1996.   query1.Active:=true;
  1997. if(query1.Active=true)then
  1998. begin
  1999. query1.Close;
  2000. query1.SQL.Clear;
  2001. query1.SQL.Add('select * from ti_choose where tno like ''93%%''');
  2002. query1.Open;
  2003.  end;
  2004. end;                 }
  2005. if TreeView1.Selected.text='第一知识点 枚举法' then
  2006.    begin
  2007.   query1.Active:=false;
  2008.   query1.Active:=true;
  2009. if(query1.Active=true)then
  2010. begin
  2011. query1.Close;
  2012. query1.SQL.Clear;
  2013. query1.SQL.Add('select * from ti_judge where tno like ''931%'' order by tno');
  2014. query1.Open;
  2015. begin
  2016.   if query1.RecordCount<>0 then
  2017.   begin
  2018.   query1.Last;
  2019.   temp:=query1.FieldValues['tno']+1;
  2020.   end
  2021.   else if query1.RecordCount=0 then
  2022.   begin
  2023.      temp:=9311;
  2024.   end;
  2025. end;
  2026.  end;
  2027.  end;                          {
  2028. if TreeView1.Selected.text='第四节 ' then
  2029.    begin
  2030.   query1.Active:=false;
  2031.   query1.Active:=true;
  2032. if(query1.Active=true)then
  2033. begin
  2034. query1.Close;
  2035. query1.SQL.Clear;
  2036. query1.SQL.Add('select * from ti_choose where tno like ''94%%''');
  2037. query1.Open;
  2038.  end;
  2039. end;                            }
  2040. if TreeView1.Selected.text='第一知识点 递归法' then
  2041.    begin
  2042.   query1.Active:=false;
  2043.   query1.Active:=true;
  2044. if(query1.Active=true)then
  2045. begin
  2046. query1.Close;
  2047. query1.SQL.Clear;
  2048. query1.SQL.Add('select * from ti_judge where tno like ''941%'' order by tno');
  2049. query1.Open;
  2050. begin
  2051.   if query1.RecordCount<>0 then
  2052.   begin
  2053.   query1.Last;
  2054.   temp:=query1.FieldValues['tno']+1;
  2055.   end
  2056.   else if query1.RecordCount=0 then
  2057.   begin
  2058.      temp:=9411;
  2059.   end;
  2060. end;
  2061.  end;
  2062.  end;
  2063.  DBMemo1.DataSource:=DataSource1;
  2064.   DBEdit1.DataSource:=DataSource1;
  2065.   DBEdit2.DataSource:=DataSource1 ;
  2066.   DBComboBox1.DataSource:=DataSource1;
  2067.   DBRadioGroup1.DataSource:=DataSource1 ;
  2068.  DBNavigator1.DataSource:=DataSource1;
  2069. end;
  2070. procedure Tjudgeform.BitBtn3Click(Sender: TObject);
  2071. begin
  2072. DBNavigator2.BtnClick(nbCancel);
  2073. end;
  2074. procedure Tjudgeform.BitBtn2Click(Sender: TObject);
  2075. begin
  2076.  if addjudge then
  2077.      begin
  2078.        if checknewjudge then
  2079.        begin
  2080.        DataModule4.Table_judge.Post;
  2081. DataModule4.Table_judge.Close;
  2082. DataModule4.Table_judge.Open;
  2083.        showmessage('添加成功!');
  2084.        addjudge:=false;
  2085.     //   inc(newshijuanhao);
  2086.      //  DataModule4.Table_shijuan.UpdateRecord;
  2087.      //  DBNavigator1.CanFocus;
  2088.      DBNavigator2.Enabled:=true;
  2089.         end
  2090.     else
  2091.     exit;
  2092. end;
  2093. end;
  2094. procedure Tjudgeform.FormCreate(Sender: TObject);
  2095. begin
  2096. addjudge:=false;
  2097. end;
  2098. procedure Tjudgeform.TreeView1MouseDown(Sender: TObject;
  2099.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  2100. begin
  2101. DBNavigator2.Enabled:=true;
  2102. end;
  2103. procedure Tjudgeform.DBNavigator1Click(Sender: TObject;
  2104.   Button: TNavigateBtn);
  2105. begin
  2106. case button of
  2107. nbFirst:
  2108. begin
  2109.   DataModule4.Table_judge.First;
  2110.   end;
  2111. end;
  2112. end;
  2113. procedure Tjudgeform.DBEdit1Change(Sender: TObject);
  2114. begin
  2115. if DBEdit1.Text='' then
  2116. begin
  2117. DBNavigator2.VisibleButtons:=[nbInsert];
  2118.  DBNavigator2.Width:=28;
  2119.  end;
  2120. if DBEdit1.Text<>'' then
  2121. begin
  2122.  DBNavigator2.Width:=56;
  2123. DBNavigator2.VisibleButtons:=[nbInsert,nbDelete];
  2124. end;
  2125. end;
  2126. end.