{"id":798,"date":"2024-12-17T08:29:18","date_gmt":"2024-12-17T00:29:18","guid":{"rendered":"https:\/\/www.cuishaofeng.com\/?p=798"},"modified":"2024-12-17T08:29:20","modified_gmt":"2024-12-17T00:29:20","slug":"tadoquery%e5%b8%b8%e7%94%a8%e9%9c%80%e4%bc%9a%e7%9f%a5%e8%af%86","status":"publish","type":"post","link":"https:\/\/www.cuishaofeng.com\/?p=798","title":{"rendered":"TADOQuery\u5e38\u7528\u9700\u4f1a\u77e5\u8bc6"},"content":{"rendered":"<div id=\"core-ai-summary-tool\"><\/div>\n<p><strong>1.Create\u4e09\u79cd\u53c2\u6570\u7684\u533a\u522b<\/strong><\/p>\n\n\n\n<p>TADOQuery.Create(nil) \u548cTADOQuery.Create(Self)\u4ee5\u53caTADOQuery.Create(Application)\u7684\u533a\u522b<\/p>\n\n\n\n<ul>\n<li>\u7528nil\u521b\u5efa\uff0c\u9700\u8981\u81ea\u5df1\u624b\u52a8\u9500\u6bc1\u521b\u5efa\u7684\u5bf9\u8c61<\/li>\n\n\n\n<li>\u7528self\u521b\u5efa\uff0c\u5982\u679c\u662f\u5728\u7a97\u4f53\u5355\u5143\u91cc\uff0c\u5219\u662f\u5728\u7a97\u4f53\u9500\u6bc1\u7684\u65f6\u5019\uff0c\u540c\u65f6\u81ea\u52a8\u9500\u6bc1\u521b\u5efa\u7684\u5bf9\u8c61<\/li>\n\n\n\n<li>\u7528Application\uff0c\u5219\u662f\u5728\u6574\u4e2a\u7a0b\u5e8f\u9000\u51fa\u7684\u65f6\u5019\u81ea\u52a8\u9500\u6bc1\u521b\u5efa\u7684\u5bf9\u8c61<\/li>\n<\/ul>\n\n\n\n<p><strong>2.Open\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u6240\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u5fc5\u987b\u662f\u6709\u8fd4\u56de\u7ed3\u679c\u7684\uff0cupdate\u3001delete\u3001insert\u90fd\u4e0d\u884c<\/p>\n\n\n\n<p><strong>3.Close\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u5173\u95ed\u8fde\u63a5\uff1b\u57fa\u4e8eTADOQuery\u7684\u64cd\u4f5c\u90fd\u4e0d\u80fd\u8fdb\u884c<\/p>\n\n\n\n<p><strong>4.SQL\u5c5e\u6027<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u5b58\u653eSQL\u8bed\u53e5\u7684\u5217\u8868<\/p>\n\n\n\n<ul>\n<li>Clear\uff1a\u6e05\u7a7aSQL\u8bed\u53e5<\/li>\n\n\n\n<li>Add\uff1a\u589e\u52a0SQL\u8bed\u53e5\u7684\u5185\u5bb9<\/li>\n<\/ul>\n\n\n\n<p><strong>5.\u5bf9\u4e8eRecord\u7684\u64cd\u4f5c&nbsp;<\/strong><\/p>\n\n\n\n<ul>\n<li>Prior\u65b9\u6cd5\uff1a\u524d\u4e00\u4e2a\u8bb0\u5f55<\/li>\n\n\n\n<li>Next\u65b9\u6cd5\uff1a\u4e0b\u4e00\u4e2a\u8bb0\u5f55<\/li>\n\n\n\n<li>First\u65b9\u6cd5\uff1a\u7b2c\u4e00\u4e2arecord<\/li>\n\n\n\n<li>Last\u65b9\u6cd5\uff1a\u6700\u540e\u4e00\u4e2arecord<\/li>\n<\/ul>\n\n\n\n<p><strong>6.GetFieldNames\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u83b7\u53d6\u4e00\u4e2a\u65b0\u7684\u8868\u7684\u6240\u6709\u540d\u5b57\uff0c\u4f8b\u5982<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>GetFieldNmes(ListBoxs<\/code><code>.<\/code><code>Items);<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>7.\u4fee\u6539\u4e00\u4e2a\u8bb0\u5f55\u53ef\u4ee5\u7528update SQL\u6267\u884c<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1234<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>Close;<\/code><code>ADOQuery<\/code><code>.<\/code><code>SQL<\/code><code>.<\/code><code>Clear;<\/code><code>ADOQuery<\/code><code>.<\/code><code>SQL<\/code><code>.<\/code><code>Add(<\/code><code>'Update SQL \u8bed\u53e5'<\/code><code>);<\/code><code>ADOQuery<\/code><code>.<\/code><code>ExecSQL;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u3000\u3000\u4e5f\u53ef\u4ee5\u7528<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>Edit;<\/code><code>ADOQuery<\/code><code>.<\/code><code>FieldByName(<\/code><code>'uno'<\/code><code>).AsString:=<\/code><code>'no1'<\/code><code>......<\/code><code>ADOQuery<\/code><code>.<\/code><code>FieldByName(<\/code><code>'uname'<\/code><code>).AsString:=&nbsp;<\/code><code>'jack'<\/code><code>;<\/code><code>TADOQuery<\/code><code>.<\/code><code>Post;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u3000\u3000\u6ce8\u610f\u7b2c\u4e00\u79cd\u5f62\u5f0f\u4e0d\u8981Post\uff0c\u7b2c\u4e8c\u79cd\u5f62\u5f0f\u5fc5\u987bPost\u624d\u80fd\u4fdd\u8bc1\u4fee\u6539\u4e86\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p><strong>8.\u589e\u52a0\u4e00\u6761\u8bb0\u5f55<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u53ef\u4ee5\u4f7f\u7528SQL\u8bed\u53e5\uff0c\u548cupdate\u4e00\u6837\u3002<\/p>\n\n\n\n<p>\u3000\u3000\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd9\u6837\u7684\u65b9\u5f0f\uff0c\u4f8b\u5b50<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>12345<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>Append;<\/code><code>ADOQuery<\/code><code>.<\/code><code>FieldByName(<\/code><code>'uno'<\/code><code>).AsString:=&nbsp;<\/code><code>'no2'<\/code><code>;<\/code><code>...<\/code><code>ADOQuery<\/code><code>.<\/code><code>FieldByName(<\/code><code>'uname'<\/code><code>).AsString:=&nbsp;<\/code><code>'name'<\/code><code>;<\/code><code>ADOQuery<\/code><code>.<\/code><code>Post;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>9.\u5220\u9664\u4e00\u6761\u8bb0\u5f55<\/strong><\/p>\n\n\n\n<p>\u3000\u3000\u53ef\u4ee5\u76f4\u63a5\u5220\u9664<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>Delete;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u3000\u3000\u4e5f\u53ef\u4ee5\u4f7f\u7528SQL\u5220\u9664<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>123<\/td><td><code>ADOQuery<\/code><code>.<\/code><code>SQL<\/code><code>.<\/code><code>Clear;<\/code><code>ADOQuery<\/code><code>.<\/code><code>SQL<\/code><code>.<\/code><code>Add(<\/code><code>'delete from practice where uname='<\/code><code>'jack'<\/code><code>' '<\/code><code>);<\/code><code>ADOQuery<\/code><code>.<\/code><code>ExecSQL;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1.Create\u4e09\u79cd\u53c2\u6570\u7684\u533a\u522b TADOQuery.Create(nil) \u548cTADOQuery.Create(Self)\u4ee5\u53caTADOQuery.Create(Application)\u7684\u533a\u522b 2.Open\u65b9\u6cd5 \u3000\u3000\u6240\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u5fc5\u987b\u662f&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"topic":[],"_links":{"self":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/798"}],"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=798"}],"version-history":[{"count":1,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions"}],"predecessor-version":[{"id":799,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions\/799"}],"wp:attachment":[{"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=798"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.cuishaofeng.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}