{"id":445,"date":"2023-03-27T10:53:49","date_gmt":"2023-03-27T02:53:49","guid":{"rendered":"https:\/\/www.cuishaofeng.com\/?p=445"},"modified":"2024-10-22T14:42:20","modified_gmt":"2024-10-22T06:42:20","slug":"delphi-%e7%a8%8b%e5%ba%8f%e8%bf%90%e8%a1%8c%e6%97%b6%e6%8f%90%e7%a4%ba%e5%af%b9%e8%b1%a1%e6%89%93%e5%bc%80%e6%97%b6%ef%bc%8c%e4%b8%8d%e5%85%81%e8%ae%b8%e6%93%8d%e4%bd%9c%e9%94%99%e8%af%af%ef%bc%9b","status":"publish","type":"post","link":"https:\/\/www.cuishaofeng.com\/?p=445","title":{"rendered":"Delphi \u7a0b\u5e8f\u8fd0\u884c\u65f6\u63d0\u793a\u5bf9\u8c61\u6253\u5f00\u65f6\uff0c\u4e0d\u5141\u8bb8\u64cd\u4f5c\u9519\u8bef\uff1b"},"content":{"rendered":"<div id=\"core-ai-summary-tool\"><\/div>\n<p>\u7b2c\u4e00\u79cd\uff1aado \u5bf9\u8c61\u6253\u5f00\u65f6\uff0c\u4e0d\u5141\u8bb8\u64cd\u4f5c(\u5e26\u53c2\u6570\u67e5\u8be2\uff09<\/p>\n\n\n\n<p>delphi\uff0c\u7528ADO\u64cd\u4f5c\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n<p>procedure TForm1.Button1Click(Sender: TObject);&nbsp;&nbsp; \/\/*\u67e5\u8be2Bt*\/<br>&nbsp;var<br>&nbsp; i :integer;<\/p>\n\n\n\n<p>&nbsp; CurPage:integer;<\/p>\n\n\n\n<p>&nbsp; NumEveryPage :integer;<br>begin<br>&nbsp; CurPage:=0;<br>&nbsp; NumEveryPage:=1000;<\/p>\n\n\n\n<p>&nbsp; \/\/1 ADOQuerySelect.Close;<\/p>\n\n\n\n<p>&nbsp; \/\/2 conn.Close;<br>&nbsp; conn.ConnectionString:=&#8217;Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyAccessDatabase&#8217;;<br>&nbsp; conn.LoginPrompt:=false;&nbsp; \/\/\u4e0d\u8981\u8f93\u5165\u5bc6\u7801<\/p>\n\n\n\n<p>&nbsp; ADOQuerySelect.SQL.Clear;&nbsp;&nbsp; \/\/\u67e5\u8be2\u6570\u636e<br>&nbsp; sql:=&#8217;select * from &#8216;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/\u67e5\u8be2\u8bed\u53e5,\u5e26\u53c2\u6570\u91cf\u67e5\u8be2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216; (select top %d * from &#8216;+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216; (select top %d * from outputdata &#8216; +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;order by \u65e5\u671f &#8216;+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216; )&#8217;+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216; order by \u65e5\u671f desc &#8216;+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216; )&#8217;+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8216;order by \u65e5\u671f&#8217;;<br>&nbsp; ADOQuerySelect.SQL.add(Format(sql,[NumEveryPage,NumEveryPage*(CurPage+1)]));<br>&nbsp; ADOQuerySelect.Prepared;<br>&nbsp; ADOQuerySelect.Active:=True;&nbsp; \/\/\u6267\u884c\u67e5\u8be2<\/p>\n\n\n\n<p>&nbsp; \/\/ADOQuery1.Active:=true;<br>end;<\/p>\n\n\n\n<p>\u5f53\u518d\u6b21\u6309\u6309\u94ae\u65f6\u4f1a\u63d0\u793a\uff1a<\/p>\n\n\n\n<p>\u5bf9\u8c61\u6253\u5f00\u65f6\u4e0d\u5141\u8bb8\u64cd\u4f5c&nbsp; \u7684\u5f02\u5e38\u3002\u5b9a\u4f4d\u5728ADOQuerySelect.SQL.Clear;&nbsp;&nbsp; \/\/\u67e5\u8be2\u6570\u636e&nbsp; \u8fd9\u4e00\u884c\u3002<\/p>\n\n\n\n<p>\u53bb\u7f51\u4e0a\u627e\u5230\u539f\u56e0\u662fADOQuerySelect \u6253\u5f00\u4e86\u3002<\/p>\n\n\n\n<p>1\u5728\u5f00\u59cb\u7684\u65f6\u5019\u52a0\u5165\u4e00\u53e5:ADOQuerySelect.Close;\u628a\u5b83\u5173\u95ed\u5427\u3002<\/p>\n\n\n\n<p>\u8fd0\u884c\u53d1\u73b0conn.LoginPromot:=false\u90a3\u884c\u4e5f\u63d0\u793a\u4e00\u6837\u7684\u9519\u8bef\u3002\u90a3\u5c31\u5e94\u8be5\u662f\u628aconn\u4e5f\u5173\u4e86\u3002<\/p>\n\n\n\n<p>2 conn.Close\u4e5f\u52a0\u4e0a\uff0c\u5c31\u662f\u4e0a\u9762\u7684\u4ee3\u7801\u6ce8\u91ca\u7684\u90a3\u4e24\u884c\u52a0\u4e0a\u5c31\u597d\u4e86\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u79cd\uff1a<\/p>\n\n\n\n<p>\u95ee\u9898\u7684\u539f\u56e0\u53ef\u80fd\uff1a<\/p>\n\n\n\n<p>1\u3001\u5728\u5176\u4ed6\u5730\u65b9\u5df2\u7ecf\u6253\u5f00\u8fd9\u91cc\u6ca1\u6709\u7528close\u5148\u8fdb\u884c\u5173\u95ed\u5728open<\/p>\n\n\n\n<p>2\u3001\u5982\u679c\u4f60\u7684\u7a0b\u5e8f\u662f\u591a\u7ebf\u7a0b\u7684\u6d3b\uff0c\u867d\u7136\u4e5f\u5199\u4e86close\u4f46\u662f\u8fd8\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \u539f\u56e0\u662f\u5f53\u4f60\u8fd9\u4e2a\u7ebf\u7a0b\u5230sql\u8bed\u53e5\u65f6\u7a0b\u5e8f\u8df3\u5230\u4e0b\u4e00\u4e2a\u7ebf\u7a0b\u6267\u884c\u4e86open\uff0c\u53c8\u56de\u6765\u6267\u884c\u524d\u4e00\u4e2a\u7ebf\u7a0b\u7684open\uff0c\u5c31\u4f1a\u62a5\u540c\u6837\u7684\u9519\u8bef<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u529e\u6cd5\uff1a<\/p>\n\n\n\n<p>1\u3001\u5355\u7ebf\u7a0b\u5c31\u5c06close\u5728sql\u8bed\u53e5\u4e4b\u524d\uff0c\u5148\u5173\u95ed\u518d\u6253\u5f00<\/p>\n\n\n\n<p>2\u3001\u591a\u7ebf\u7a0b\u65f6\u5c3d\u91cf\u4e0d\u8981\u4f7f\u7528\u540c\u4e00\u4e2a\u6570\u636e\u5e93\u63a7\u4ef6\uff0c\u5982\u679c\u4f7f\u7528\u540c\u4e00\u4e2a\u5219\u5c3d\u91cf\u5728\u540c\u4e00\u4e2a\u7ebf\u7a0b\u91cc\u5c06\u6240\u9700\u529f\u80fd\u5904\u7406\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e09\u79cd\uff1a\u6211\u672c\u4eba\u9047\u5230\u7684\u95ee\u9898<br><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"90\" class=\"wp-image-447\" style=\"width: 150px;\" src=\"https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u6253\u5f00\u65f6\u5019\u4e0d\u5141\u8bb8\u64cd\u4f5c.png\" alt=\"\"><\/p>\n\n\n\n<p>\u53ea\u9700\u8981\u5728\u5f00\u53d1\u6a21\u5f0f\u4e2d\u5982\u56fe\u663e\u793a\u7684\u62a5\u9519\u539f\u56e0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"362\" height=\"210\" src=\"https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u6253\u5f00.png\" alt=\"\" class=\"wp-image-448\" srcset=\"https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u6253\u5f00.png 362w, https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u6253\u5f00-300x174.png 300w\" sizes=\"(max-width: 362px) 100vw, 362px\" \/><figcaption class=\"wp-element-caption\">\u4fee\u6539\u4e3a\uff1a<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"344\" height=\"209\" src=\"https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u5173\u95ed.png\" alt=\"\" class=\"wp-image-449\" srcset=\"https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u5173\u95ed.png 344w, https:\/\/www.cuishaofeng.com\/wp-content\/uploads\/2023\/03\/\u5bf9\u8c61\u5173\u95ed-300x182.png 300w\" sizes=\"(max-width: 344px) 100vw, 344px\" \/><figcaption class=\"wp-element-caption\">\u518d\u6b21\u7f16\u8bd1\u8fd0\u884c\u7a0b\u5e8f\u5373\u53ef\uff0c\u4e0d\u5728\u51fa\u73b0\u62a5\u9519\u73b0\u8c61\u3002<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u79cd\uff1aado \u5bf9\u8c61\u6253\u5f00\u65f6\uff0c\u4e0d\u5141\u8bb8\u64cd\u4f5c(\u5e26\u53c2\u6570\u67e5\u8be2\uff09 delphi\uff0c\u7528ADO\u64cd\u4f5c\u6570\u636e\u5e93\uff1a procedure TForm1.Button1Click(Sender: TObject);&nbsp;&nbsp; \/\/*\u67e5\u8be2Bt*\/&nbsp;&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[78],"topic":[],"_links":{"self":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/445"}],"collection":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=445"}],"version-history":[{"count":1,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/445\/revisions"}],"predecessor-version":[{"id":691,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/445\/revisions\/691"}],"wp:attachment":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=445"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}