Delphi复习纲要.doc_第1页
Delphi复习纲要.doc_第2页
Delphi复习纲要.doc_第3页
Delphi复习纲要.doc_第4页
Delphi复习纲要.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

_Delphi复习纲要implementationvar s,s1,s2:string;xop:array0.10 of string;procedure TForm1.BitBtn1Click(Sender: TObject);beginxop0:=;xop1:=;xop2:=;xop3:=;xop4:=;xop5:=;s1:=dbgrid1.Columnscombobox1.ItemIndex.FieldName+xopcombobox2.ItemIndex+edit1.Text+;if combobox3.itemindex=0 thenbegins2:=dbgrid1.Columnscombobox4.ItemIndex.FieldName+xopcombobox5.ItemIndex+edit2.Text+;adoquery1.close;adoquery1.sql.text:=select * from s where +s1+ and +s2;adoquery1.open;endelse if combobox3.itemindex=1 thenbegins2:=dbgrid1.Columnscombobox4.ItemIndex.FieldName+xopcombobox5.ItemIndex+edit2.Text+;adoquery1.close;adoquery1.sql.text:=select * from s where +s1+ or +s2;adoquery1.open;endelsebeginadoquery1.close;adoquery1.sql.text:=select * from s where +s1;adoquery1.open;end;end;procedure TForm1.ComboBox3Click(Sender: TObject);begincombobox4.Visible:=true;combobox5.Visible:=true;edit2.Visible:=true;end;end.implementationprocedure TForm2.BitBtn1Click(Sender: TObject);varff:textfile;s1,s2,s3:string;beginassignfile(ff,d:a1.txt); /新建并打开文件rewrite(ff); /Rewrite 过程能创建一个新文件并打开它;使用Reset 打开的/文本文件是只读的,使用Rewrite 和Append 打开的文本文件只能写入adoquery1.Close;adoquery1.SQL.Text:=select * from categories ;adoquery1.Open;with adoquery1 dobegin disablecontrols; first; while not eof do begin s1:=fieldbyname(categoryid).AsString; s2:=fieldbyname(categoryname).AsString; s3:=fieldbyname(description).AsString; writeln(ff,s1+ +s2+ +s3); next; end; closefile(ff); enablecontrols;end;memo1.Lines.Clear;memo1.Lines.LoadFromFile(d:a1.txt);categorypanel1.Collapsed:=false;categorypanel2.Collapsed:=true;end;procedure TForm2.BitBtn2Click(Sender: TObject);vars,s1,s2:string;nd:ttreenode;beginTreeView1.Items.Clear;adoquery1.disablecontrols;adoquery1.Close;adoquery1.SQL.Text:=select * from categories ;adoquery1.Open;while not adoquery1.Eof dobegin s:=adoquery1.FieldByName(categoryname).AsString; s1:=adoquery1.FieldByName(categoryid).AsString; ADOQuery2.Close; adoquery2.SQL.Text:=select * from products where categoryid=:s1 ; adoquery2.Parameters.ParamByName(s1).value:=s1; adoquery2.open; nd:=treeview1.Items.Add(nil,s); adoquery2.disablecontrols; adoquery2.first; while not adoquery2.Eof do begin s2:=adoquery2.FieldByName(productid).AsString+ +adoquery2.FieldByName(productname).AsString; treeview1.Items.AddChild(nd,s2); adoquery2.Next; end; adoquery2.enablecontrols; adoquery1.Next;end;adoquery1.enablecontrols;categorypanel1.Collapsed:=true;categorypanel2.Collapsed:=false;end;end.方法一:见课本P123页;利用Delphi语句和数组产生树节点procedure TForm4.FormShow(Sender: TObject);var s:string; k:integer; node:array1.3 of ttreenode;beginadoquery1.Close;adoquery1.SQL.Text:=select * from x_city order by cityid ;adoquery1.Open;while not adoquery1.Eof dobegins:=adoquery1.FieldByName(cityid).AsString+ +adoquery1.FieldByName(city).AsString;k:=adoquery1.Field

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论