{"id":59419,"date":"2024-10-12T21:53:16","date_gmt":"2024-10-12T13:53:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/59419\/"},"modified":"2024-10-12T21:53:16","modified_gmt":"2024-10-12T13:53:16","slug":"asp%e4%bd%bf%e7%94%a8mysql%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%a6%e7%8f%be%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/59419\/","title":{"rendered":"ASP\u4f7f\u7528MySQL\u6578\u64da\u5eab\u5be6\u73fe\u65b9\u6cd5"},"content":{"rendered":"<h1 id=\"asp%e4%bd%bf%e7%94%a8mysql%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%a6%e7%8f%be%e6%96%b9%e6%b3%95-sPnSxsIzDl\">ASP\u4f7f\u7528MySQL\u6578\u64da\u5eab\u5be6\u73fe\u65b9\u6cd5<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u958b\u767c\u4e2d\uff0cASP\uff08Active Server Pages\uff09\u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u6280\u8853\uff0c\u7279\u5225\u662f\u5728\u69cb\u5efa\u52d5\u614b\u7db2\u7ad9\u548cWeb\u61c9\u7528\u7a0b\u5e8f\u65b9\u9762\u3002MySQL\u4f5c\u70ba\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u8207ASP\u7684\u7d50\u5408\u53ef\u4ee5\u5be6\u73fe\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u548c\u6aa2\u7d22\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u5728ASP\u4e2d\u4f7f\u7528MySQL\u6578\u64da\u5eab\uff0c\u4e26\u63d0\u4f9b\u5177\u9ad4\u7684\u5be6\u73fe\u65b9\u6cd5\u548c\u793a\u4f8b\u4ee3\u78bc\u3002<\/p>\n<h2 id=\"%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-sPnSxsIzDl\">\u74b0\u5883\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u60a8\u7684\u958b\u767c\u74b0\u5883\u5df2\u7d93\u8a2d\u7f6e\u597d\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u8981\u6c42\uff1a<\/p>\n<ul>\n<li>\u5b89\u88ddIIS\uff08Internet Information Services\uff09\u4f5c\u70baWeb\u4f3a\u670d\u5668\u3002<\/li>\n<li>\u5b89\u88ddASP\u652f\u6301\u3002<\/li>\n<li>\u5b89\u88ddMySQL\u6578\u64da\u5eab\u3002<\/li>\n<li>\u5b89\u88ddMySQL ODBC\u9a45\u52d5\u7a0b\u5e8f\uff0c\u4ee5\u4fbfASP\u53ef\u4ee5\u8207MySQL\u9032\u884c\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<h2 id=\"%e9%80%a3%e6%8e%a5mysql%e6%95%b8%e6%93%9a%e5%ba%ab-sPnSxsIzDl\">\u9023\u63a5MySQL\u6578\u64da\u5eab<\/h2>\n<p>\u5728ASP\u4e2d\u9023\u63a5MySQL\u6578\u64da\u5eab\u7684\u7b2c\u4e00\u6b65\u662f\u8a2d\u7f6e\u6578\u64da\u5eab\u9023\u63a5\u5b57\u7b26\u4e32\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre><code>\n\n<\/code><\/pre>\n<p>\u5728\u9019\u6bb5\u4ee3\u78bc\u4e2d\uff0c\u60a8\u9700\u8981\u6839\u64da\u5be6\u969b\u60c5\u6cc1\u66ff\u63db\u4ee5\u4e0b\u53c3\u6578\uff1a<\/p>\n<ul>\n<li><strong>SERVER<\/strong>: MySQL\u4f3a\u670d\u5668\u7684\u5730\u5740\uff0c\u901a\u5e38\u662flocalhost\u3002<\/li>\n<li><strong>DATABASE<\/strong>: \u60a8\u8981\u9023\u63a5\u7684\u6578\u64da\u5eab\u540d\u7a31\u3002<\/li>\n<li><strong>USER<\/strong>: \u7528\u65bc\u9023\u63a5\u6578\u64da\u5eab\u7684\u7528\u6236\u540d\u3002<\/li>\n<li><strong>PASSWORD<\/strong>: \u7528\u6236\u7684\u5bc6\u78bc\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%9f%b7%e8%a1%8csql%e6%9f%a5%e8%a9%a2-sPnSxsIzDl\">\u57f7\u884cSQL\u67e5\u8a62<\/h2>\n<p>\u4e00\u65e6\u6210\u529f\u9023\u63a5\u5230\u6578\u64da\u5eab\uff0c\u60a8\u5c31\u53ef\u4ee5\u57f7\u884cSQL\u67e5\u8a62\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u67e5\u8a62\u6578\u64da\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>\n&lt;%\nDim rs, sql\nsql = &quot;SELECT * FROM your_table&quot;\nSet rs = conn.Execute(sql)\n\nDo While Not rs.EOF\n    Response.Write &quot;Column1: &quot; &amp; rs(&quot;column1&quot;) &amp; &quot;<br>\"\n    Response.Write \"Column2: \" &amp; rs(\"column2\") &amp; \"<br>\"\n    rs.MoveNext\nLoop\n\nrs.Close\nSet rs = Nothing\n%&gt;\n<\/code><\/pre>\n<p>\u5728\u9019\u6bb5\u4ee3\u78bc\u4e2d\uff0c\u6211\u5011\u57f7\u884c\u4e86\u4e00\u500b\u7c21\u55ae\u7684SELECT\u67e5\u8a62\uff0c\u4e26\u5c07\u7d50\u679c\u8f38\u51fa\u5230\u7db2\u9801\u4e0a\u3002\u8acb\u6839\u64da\u60a8\u7684\u6578\u64da\u8868\u7d50\u69cb\u66ff\u63db<code>your_table<\/code>\u548c\u5217\u540d\u3002<\/p>\n<h2 id=\"%e6%8f%92%e5%85%a5%e6%95%b8%e6%93%9a-sPnSxsIzDl\">\u63d2\u5165\u6578\u64da<\/h2>\n<p>\u9664\u4e86\u67e5\u8a62\u6578\u64da\uff0c\u60a8\u9084\u53ef\u4ee5\u5411\u6578\u64da\u5eab\u63d2\u5165\u65b0\u6578\u64da\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u63d2\u5165\u6578\u64da\u7684\u793a\u4f8b\uff1a<\/p>\n<pre><code>\n\n<\/code><\/pre>\n<p>\u5728\u9019\u6bb5\u4ee3\u78bc\u4e2d\uff0c\u6211\u5011\u4f7f\u7528INSERT\u8a9e\u53e5\u5c07\u65b0\u6578\u64da\u63d2\u5165\u5230\u6307\u5b9a\u7684\u8868\u4e2d\u3002\u8acb\u6839\u64da\u60a8\u7684\u9700\u6c42\u66ff\u63db<code>your_table<\/code>\u548c\u76f8\u61c9\u7684\u5217\u540d\u53ca\u503c\u3002<\/p>\n<h2 id=\"%e9%97%9c%e9%96%89%e9%80%a3%e6%8e%a5-sPnSxsIzDl\">\u95dc\u9589\u9023\u63a5<\/h2>\n<p>\u5b8c\u6210\u6240\u6709\u64cd\u4f5c\u5f8c\uff0c\u8a18\u5f97\u95dc\u9589\u6578\u64da\u5eab\u9023\u63a5\uff1a<\/p>\n<pre><code>\n\n<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-sPnSxsIzDl\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5728ASP\u4e2d\u6210\u529f\u4f7f\u7528MySQL\u6578\u64da\u5eab\u4f86\u5be6\u73fe\u6578\u64da\u7684\u5b58\u5132\u548c\u6aa2\u7d22\u3002\u9019\u7a2e\u7d44\u5408\u4e0d\u50c5\u80fd\u63d0\u9ad8\u7db2\u7ad9\u7684\u52d5\u614b\u6027\uff0c\u9084\u80fd\u6709\u6548\u7ba1\u7406\u6578\u64da\u3002\u82e5\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u670d\u52d9\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u90e8\u7f72\u60a8\u7684ASP\u61c9\u7528\u7a0b\u5e8f\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u7db2\u7ad9\u63d0\u4f9b\u66f4\u7a69\u5b9a\u7684\u6027\u80fd\u548c\u66f4\u5feb\u7684\u97ff\u61c9\u901f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528ASP\u8207MySQL\u6578\u64da\u5eab\u6574\u5408\uff0c\u5be6\u73fe\u6578\u64da\u5b58\u53d6\u8207\u7ba1\u7406\u7684\u5b8c\u6574\u65b9\u6cd5\uff0c\u63d0\u5347\u7db2\u7ad9\u6027\u80fd\u8207\u529f\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-59419","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=59419"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59419\/revisions"}],"predecessor-version":[{"id":59420,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59419\/revisions\/59420"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=59419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=59419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=59419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}