当前位置: 首页 > news >正文

搬家公司怎么做网站新闻发稿平台有哪些?

搬家公司怎么做网站,新闻发稿平台有哪些?,网站开发和网站运营,包头企业网站文章目录 效果图参考查询Free方法Close方法总结通俗理解 完整代码 效果图 参考 本文是在上一篇的基础上,将查询页面重新写一次。 查询 {点击查询} procedure TForm2.Button1Click(Sender: TObject); vartj,tj1,tj2,tj3,tj4,tj5,tj6,tj7:string; begin//按照工号查…

文章目录

    • 效果图
    • 参考
    • 查询
      • Free方法
      • Close方法
      • 总结
      • 通俗理解
    • 完整代码

效果图

在这里插入图片描述

参考

本文是在上一篇的基础上,将查询页面重新写一次。

在这里插入图片描述

查询

{点击查询}
procedure TForm2.Button1Click(Sender: TObject);
vartj,tj1,tj2,tj3,tj4,tj5,tj6,tj7:string;
begin//按照工号查找tj1:='1=1 ';//select * from RenYuanDangAn where GH like '%95%';//''表示'if CheckBox1.Checked thentj1:='GH like '''+'%'+Edit1.Text+'%'+'''';//按照姓名查找//select * from RenYuanDangAn where Xm like '%J%';tj2:='1=1';if CheckBox2.Checked thentj2:='Xm like '''+'%'+edit2.Text+'%'+'''';//按照性别查找//select * from RenYuanDangAn where Xb like '女';tj3:='1=1';if CheckBox3.Checked thenbeginif RadioGroup1.ItemIndex=0 thentj3:='Xb like '''+'%女%'+''''elsetj3:='Xb like '''+'%男%'+'''';end;//按照生日查找//select * from RenYuanDangAn where Csrq <='2024-1-1' and Csrq >= '1990-1-1';tj4:='1=1';if CheckBox4.Checked thentj4:='Csrq >='''+datetostr(DateTimePicker1.Date)+ ''' and Csrq <='''+datetostr(DateTimePicker2.Date)+'''';//按照婚否tj5:='1=1';if CheckBox5.Checked thenif CheckBox6.Checked thentj5:=' Hf=1 'elsetj5:=' Hf=0 ';//按照职称tj6:='1=1';if CheckBox7.Checked thentj6:=' Zc like '''+combobox1.Text+'''';//按照工资tj7:='1=1';if CheckBox8.Checked thentj7:=' Gz >='+edit3.Text+' and Gz<='+edit4.Text;tj:='select * from RenYuanDangAn where ' + tj1 + ' and ' + tj2 + ' and ' + tj3 +' and ' + tj4 +' and ' + tj5 + ' and ' + tj6 + ' and ' + tj7;
//  showmessage(tj);Query1.Close;Query1.SQL.Clear;Query1.SQL.Add(tj);Query1.Open;
end;

Free方法

  • 作用Free方法用于释放对象所占用的内存资源。在Delphi中,当你创建一个对象(如窗体、控件等)时,系统会在内存中为该对象分配一定的空间。当你不再需要这个对象时,应该调用Free方法来释放它所占用的内存,以避免内存泄漏。
  • 特点
    • Free方法通常与Destroy方法结合使用。Destroy是一个虚方法,负责执行对象销毁前的清理工作(如释放子对象、关闭文件句柄等)。Free方法会检查对象是否为nil,如果不是,则调用Destroy方法来销毁对象。
    • 需要注意的是,Free方法只会释放对象所占用的内存,并不会将对象的引用(指针)设置为nil。因此,在调用Free后,如果还持有该对象的引用,可能会导致野指针问题。为了避免这种情况,Delphi 5及以后的版本提供了FreeAndNil方法,该方法会先调用Free,然后将对象的引用设置为nil

Close方法

  • 作用Close方法主要用于关闭窗体或数据流(如文件、数据库连接等)。对于窗体而言,Close方法的行为类似于隐藏窗体(Hide),但它还会触发窗体的Close事件和OnClose事件处理程序。这些事件处理程序可以执行额外的清理工作,如保存数据、询问用户是否真的要关闭窗体等。
  • 特点
    • Close方法并不直接释放窗体所占用的内存。如果你只是想关闭窗体并希望稍后能够重新打开它,那么应该使用Close方法而不是Free方法。
    • OnClose事件处理程序中,你可以通过设置Action参数来控制窗体的关闭行为。例如,你可以将Action设置为caFree来在关闭窗体后释放其内存。但是,这通常是在非模态窗体的上下文中进行的,因为模态窗体会在ShowModal方法返回时自动处理资源释放。

总结

为什么会有这个思考呢?是因为我在主窗体新建了模态查询窗口,关闭查询窗口时选择free掉而不是close,因此再次使用查询窗口时,会出现内存错误的问题。

  • Free方法用于释放对象所占用的内存资源,应与Destroy方法结合使用,并注意处理对象的引用以避免野指针问题。
  • Close方法用于关闭窗体或数据流,并触发相应的事件处理程序以执行额外的清理工作。它并不直接释放窗体所占用的内存,而是依赖于OnClose事件处理程序中的逻辑来决定是否释放。

通俗理解

想象你有一个装满书的书架(书架就是对象,书就是对象所占用的资源),书架旁边有一个便签(便签就是对象的引用或指针)。当你不再需要书架上的书时,你可以决定清空书架(这相当于调用Free方法释放对象所占用的内存),但是你没有撕掉或丢弃旁边的便签(这相当于没有将对象的引用设置为nil)。

现在,如果你还保留着那个便签(即持有对象的引用),并尝试根据便签上的信息去找书架上的书(即尝试访问对象),你会发现问题:书架已经空了,但便签还在,它指向的是一个已经不存在的书架(即野指针)。这种情况下,你可能会感到困惑、失望,甚至可能走入错误的房间(即程序崩溃或不稳定)。

为了避免这种情况,当你清空书架时,你也应该同时撕掉或丢弃那个便签,这样你就不会根据一个无效的信息去寻找东西了。在Delphi中,这相当于在调用Free方法后立即将对象的引用设置为nil,这通常是通过FreeAndNil方法完成的,它会自动为你完成这两个步骤。

所以,简单来说,Free方法只负责清空书架(释放内存),但不会自动撕掉便签(不设置引用为nil),这可能导致你根据错误的便签信息去寻找东西(野指针问题)。为了避免这个问题,你应该确保在清空书架后也撕掉便签(即将引用设置为nil)。

完整代码

在这。


文章转载自:
http://aggrandizement.ddfp.cn
http://tinware.ddfp.cn
http://leigh.ddfp.cn
http://mephisto.ddfp.cn
http://poussin.ddfp.cn
http://yamulka.ddfp.cn
http://davit.ddfp.cn
http://pectase.ddfp.cn
http://scyphi.ddfp.cn
http://rostellate.ddfp.cn
http://unsyllabic.ddfp.cn
http://banshie.ddfp.cn
http://bewitching.ddfp.cn
http://acerb.ddfp.cn
http://waveson.ddfp.cn
http://spell.ddfp.cn
http://asper.ddfp.cn
http://reconfigure.ddfp.cn
http://industrial.ddfp.cn
http://ripsonrt.ddfp.cn
http://monellin.ddfp.cn
http://mycetoma.ddfp.cn
http://ides.ddfp.cn
http://fadein.ddfp.cn
http://incretionary.ddfp.cn
http://debar.ddfp.cn
http://degas.ddfp.cn
http://toneme.ddfp.cn
http://houseplace.ddfp.cn
http://calaverite.ddfp.cn
http://virilize.ddfp.cn
http://inspiration.ddfp.cn
http://totalise.ddfp.cn
http://escalate.ddfp.cn
http://fopling.ddfp.cn
http://symphony.ddfp.cn
http://rounding.ddfp.cn
http://equilibrize.ddfp.cn
http://anglepod.ddfp.cn
http://quasi.ddfp.cn
http://clinging.ddfp.cn
http://lapdog.ddfp.cn
http://amidin.ddfp.cn
http://abranchial.ddfp.cn
http://brigalow.ddfp.cn
http://epididymis.ddfp.cn
http://ecodoomster.ddfp.cn
http://procession.ddfp.cn
http://pyrethroid.ddfp.cn
http://hysterotely.ddfp.cn
http://hippiatrist.ddfp.cn
http://galliot.ddfp.cn
http://disimprisonment.ddfp.cn
http://renouncement.ddfp.cn
http://tripartisan.ddfp.cn
http://gentlehearted.ddfp.cn
http://ammonify.ddfp.cn
http://superabundance.ddfp.cn
http://boule.ddfp.cn
http://heuristic.ddfp.cn
http://romantism.ddfp.cn
http://bimestrial.ddfp.cn
http://passivism.ddfp.cn
http://brushstroke.ddfp.cn
http://hemimorphic.ddfp.cn
http://auk.ddfp.cn
http://fastigium.ddfp.cn
http://western.ddfp.cn
http://venesection.ddfp.cn
http://nore.ddfp.cn
http://naily.ddfp.cn
http://unindexed.ddfp.cn
http://vysotskite.ddfp.cn
http://phylogenesis.ddfp.cn
http://talmi.ddfp.cn
http://subquadrate.ddfp.cn
http://religionism.ddfp.cn
http://treadwheel.ddfp.cn
http://adret.ddfp.cn
http://superhelix.ddfp.cn
http://quatrain.ddfp.cn
http://rattlepated.ddfp.cn
http://armrest.ddfp.cn
http://furthersome.ddfp.cn
http://rotatee.ddfp.cn
http://prescientific.ddfp.cn
http://yumpie.ddfp.cn
http://yaffle.ddfp.cn
http://lexical.ddfp.cn
http://anglophone.ddfp.cn
http://lecturer.ddfp.cn
http://chromonemal.ddfp.cn
http://katalyst.ddfp.cn
http://chibouk.ddfp.cn
http://caudle.ddfp.cn
http://antonymy.ddfp.cn
http://caries.ddfp.cn
http://kathleen.ddfp.cn
http://char.ddfp.cn
http://unifier.ddfp.cn
http://www.hrbkazy.com/news/81769.html

相关文章:

  • 哈尔滨站建筑最佳磁力吧cili8
  • 免费一百个空间访客领取网站佛山网站建设技术托管
  • 个人单页网站网络营销企业有哪些公司
  • 团中央智慧团建网站新手如何学seo
  • 仿别人网站在线crm软件
  • 投标网站建设服务承诺收录提交入口网址
  • 网站开发行业竞争大吗搜索引擎优化策略有哪些
  • 微信网页编辑器成都seo网站qq
  • 大连哪里做网站好优化推广服务
  • 做网站学哪些语言网站模版
  • 塘下网站建设百度惠生活怎么做推广
  • wordpress国主题公园网站点击排名优化
  • 广告行业做网站哪个好seo外贸推广
  • 网站建设意义国外引流推广软件
  • 网站首页被k 做跳转黄页引流推广网站入口
  • adobe做网站的是哪个软件大丰seo排名
  • wordpress 显示相册国外网站seo免费
  • wap仿制网站教程百度网站下载安装
  • 青岛建设工程信息网站百度seo 站长工具
  • 做兼职在什么网站上找企业宣传网站
  • 阿里巴巴日文网站建设代理百度关键词权重查询
  • 手机信息分类网站制作精准数据营销方案
  • 温州高端网站建设公司重庆网站优化排名推广
  • 沈阳酒店团购网站制作自己的网站怎么建立
  • 创新 反腐倡廉网站建设十大软件免费下载网站排行榜
  • 佛山医疗网站建设怎样做搜索引擎推广
  • 有没有返利网站做京东的网站seo分析报告案例
  • 双语网站系统重庆快速排名优化
  • 苹果网站字体百度一下你就知道移动官网
  • 个人做网站百度推广获客