已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年电子商务师中级职业技能鉴定试卷附答案
- 塔山矿顶板事故应急预案演练脚本
- 2025年中小学生防范电信网络诈骗知识考题测试卷附答案
- 第一节 环境管理概述教学设计-2025-2026学年高中地理湘教版选修Ⅵ环境保护-湘教版2004
- 2024年起重机作业人员Q1证理论考试练习题及答案
- 2025年心肺复苏笔试题库及答案
- 2025年安全培训考试试题及参考答案
- 2025江苏招教考试真题及答案
- 六年级上册心理健康教育教案 -7在合作中成长 | 辽大版
- 2025监装员考试真题及答案
- 学校校舍安全管理制度
- 悬臂桥面板计算理论
- 燃料电池-课件
- GB/T 31521-2015公共信息标志材料、构造和电气装置的一般要求
- GB/T 1185-2006光学零件表面疵病
- 高考体育单招英语复习连词讲解4教案
- 消费者行为分析之社会因素的影响分析课件
- 抑郁症护理查房课件
- 老年人的易发骨折的种类及处理课件
- CFG桩施工方案一期
- 清水混凝土模板施工方案
评论
0/150
提交评论