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

教育系统应用

开发平台:

Delphi

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