<br />
<b>Warning</b>:  Undefined array key "HTTP_ACCEPT_LANGUAGE" in <b>/www/wwwroot/01xj.net/wp-content/plugins/wp-ue/main.php</b> on line <b>13</b><br />
{"id":520,"date":"2014-08-21T18:29:34","date_gmt":"2014-08-21T10:29:34","guid":{"rendered":"http:\/\/www.01xj.net\/?p=520"},"modified":"2014-08-21T18:29:34","modified_gmt":"2014-08-21T10:29:34","slug":"asp%e8%b0%83%e7%94%a8%e5%b8%a6%e5%8f%82%e6%95%b0%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e7%9a%84%e5%87%a0%e7%a7%8d%e6%96%b9%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.01xj.net\/?p=520","title":{"rendered":"ASP\u8c03\u7528\u5e26\u53c2\u6570\u5b58\u50a8\u8fc7\u7a0b\u7684\u51e0\u79cd\u65b9\u5f0f"},"content":{"rendered":"<p style=\"color: #000000;\">1. \u8fd9\u4e5f\u662f\u6700\u7b80\u5355\u7684\u65b9\u6cd5,\u4e24\u4e2a\u8f93\u5165\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c\uff1a<br \/>\nset connection = server.createobject(&#8220;adodb.connection&#8221;)<br \/>\nconnection.open someDSN<br \/>\nConnection.Execute &#8220;procname varvalue1, varvalue2&#8221;<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5c06\u6240\u6709\u5bf9\u8c61\u6e05\u4e3anothing\uff0c\u91ca\u653e\u8d44\u6e90<br \/>\nconnection.close<br \/>\nset connection = nothing<\/p>\n<p style=\"color: #000000;\">\n2. \u5982\u679c\u8981\u8fd4\u56de Recordset \u96c6:<br \/>\nset connection = server.createobject(&#8220;adodb.connection&#8221;)<br \/>\nconnection.open someDSN<br \/>\nset rs = server.createobject(&#8220;adodb.recordset&#8221;)<br \/>\nrs.Open &#8220;Exec procname varvalue1, varvalue2&#8221;,connection<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5c06\u6240\u6709\u5bf9\u8c61\u6e05\u4e3anothing\uff0c\u91ca\u653e\u8d44\u6e90<br \/>\nrs.close<br \/>\nconnection.close<br \/>\nset rs = nothing<br \/>\nset connection = nothing<\/p>\n<p style=\"color: #000000;\">\n3. \u4ee5\u4e0a\u4e24\u79cd\u65b9\u6cd5\u90fd\u4e0d\u80fd\u6709\u8fd4\u56de\u503c\uff0c\uff08Recordset\u9664\u5916\uff09\uff0c\u5982\u679c\u8981\u5f97\u5230\u8fd4\u56de\u503c\uff0c\u9700\u8981\u7528Command\u7684\u65b9\u6cd5\u3002<br \/>\n\u9996\u5148\u8bf4\u660e\uff0c\u8fd4\u56de\u503c\u6709\u4e24\u79cd\u3002\u4e00\u79cd\u662f\u5728\u5b58\u50a8\u8fc7\u7a0b\u4e2d\u76f4\u63a5return\u4e00\u4e2a\u503c\uff0c\u5c31\u8c61<a class=\"keyword_link\" style=\"color: #0a50a1;\" href=\"http:\/\/product.yesky.com\/product\/225\/225032\/\" target=\"_blank\">C<\/a>\u548cVB\u7684\u51fd\u6570\u8fd4\u56de\u503c\u90a3\u6837\uff1b\u53e6\u4e00\u79cd\u662f\u53ef\u4ee5\u8fd4\u56de\u591a\u4e2a\u503c\uff0c\u5b58<br \/>\n\u50a8\u8fd9\u4e9b\u503c\u7684\u53d8\u91cf\u540d\u79f0\u9700\u8981\u5728\u8c03\u7528\u53c2\u6570\u4e2d\u5148\u884c\u6307\u5b9a\u3002<br \/>\n\u8fd9\u4e2a\u4f8b\u5b50\u8981\u5904\u7406\u591a\u79cd\u53c2\u6570\uff0c\u8f93\u5165\u53c2\u6570\uff0c\u8f93\u51fa\u53c2\u6570\uff0c\u8fd4\u56de\u8bb0\u5f55\u96c6\u4ee5\u53ca\u4e00\u4e2a\u76f4\u63a5\u8fd4\u56de\u503c\uff08\u591f\u5168\u4e86\u5427\uff1f\uff09<br \/>\n\u5b58\u50a8\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p style=\"color: #000000;\">\u3000\u3000use pubs<br \/>\nGO<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8211; \u5efa\u7acb\u5b58\u50a8\u8fc7\u7a0b<br \/>\ncreate procedure sp_PubsTest<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8211; \u5b9a\u4e49\u4e09\u4e2a\u53c2\u6570\u53d8\u91cf\uff0c\u6ce8\u610f\u7b2c\u4e09\u4e2a\uff0c\u7279\u522b\u6807\u8bb0\u662f\u7528\u4e8e\u8f93\u51fa<br \/>\n@au_lname varchar (20),<br \/>\n@intID int,<br \/>\n@intIDOut int OUTPUT<\/p>\n<p style=\"color: #000000;\">\u3000\u3000AS<\/p>\n<p style=\"color: #000000;\">\u3000\u3000SELECT @intIDOut = @intID + 1<\/p>\n<p style=\"color: #000000;\">\u3000\u3000SELECT *<br \/>\nFROM authors<br \/>\nWHERE au_lname LIKE @au_lname + &#8216;%&#8217;<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8211;\u76f4\u63a5\u8fd4\u56de\u4e00\u4e2a\u503c<br \/>\nRETURN @intID + 2<\/p>\n<p style=\"color: #000000;\">\n\u8c03\u7528\u8be5\u5b58\u50a8\u8fc7\u7a0b\u7684asp\u7a0b\u5e8f\u5982\u4e0b\uff1a<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&lt;%@ Language=VBScript %&gt;<br \/>\n&lt;%<br \/>\nDim CmdSP<br \/>\nDim adoRS<br \/>\nDim adCmdSPStoredProc<br \/>\nDim adParamReturnValue<br \/>\nDim adParaminput<br \/>\nDim adParamOutput<br \/>\nDim adInteger<br \/>\nDim iVal<br \/>\nDim oVal<br \/>\nDim adoField<br \/>\nDim adVarChar<\/p>\n<p style=\"color: #000000;\">\u3000\u3000\u2018\u8fd9\u4e9b\u503c\u5728 VB \u4e2d\u662f\u9884\u5b9a\u4e49\u5e38\u91cf\uff0c\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\uff0c\u4f46\u5728 VBScript \u4e2d\u6ca1\u6709\u9884\u5b9a\u4e49<br \/>\nadCmdSPStoredProc = 4<br \/>\nadParamReturnValue = 4<br \/>\nadParaminput = 1<br \/>\nadParamOutput = 2<br \/>\nadInteger = 3<br \/>\nadVarChar = 200<\/p>\n<p style=\"color: #000000;\">\u3000\u3000iVal = 5<br \/>\noVal = 3<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5efa\u4e00\u4e2acommand\u5bf9\u8c61<br \/>\nset CmdSP = Server.CreateObject(&#8220;ADODB.Command&#8221;)<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5efa\u7acb\u8fde\u7ed3<br \/>\nCmdSP.ActiveConnection = &#8220;Driver={SQL Server};server=(local);Uid=sa;Pwd=;Database=Pubs&#8221;<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5b9a\u4e49command \u5bf9\u8c61\u8c03\u7528\u540d\u79f0<br \/>\nCmdSP.CommandText = &#8220;sp_PubsTest&#8221;<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u8bbe\u7f6ecommand\u8c03\u7528\u7c7b\u578b\u662f\u5b58\u50a8\u8fc7\u7a0b (adCmdSPStoredProc = 4)<br \/>\nCmdSP.CommandType = adCmdSPStoredProc<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u5f80command \u5bf9\u8c61\u4e2d\u52a0\u53c2\u6570<br \/>\n&#8216;\u5b9a\u4e49\u5b58\u50a8\u8fc7\u7a0b\u6709\u76f4\u63a5\u8fd4\u56de\u503c\uff0c\u5e76\u4e14\u662f\u4e2a\u6574\u6570\uff0c\u7701\u7f3a\u503c\u662f4<br \/>\nCmdSP.Parameters.Append CmdSP.CreateParameter(&#8220;RETURN_VALUE&#8221;, adInteger, adParamReturnValue, 4)<br \/>\n&#8216;\u5b9a\u4e49\u4e00\u4e2a\u5b57\u7b26\u578b\u8f93\u5165\u53c2\u6570<br \/>\nCmdSP.Parameters.Append CmdSP.CreateParameter(&#8220;@au_lname&#8221;, adVarChar, adParaminput, 20, &#8220;M&#8221;)<br \/>\n&#8216;\u5b9a\u4e49\u4e00\u4e2a\u6574\u578b\u8f93\u5165\u53c2\u6570<br \/>\nCmdSP.Parameters.Append CmdSP.CreateParameter(&#8220;@intID&#8221;, adInteger, adParamInput, , iVal)<br \/>\n&#8216;\u5b9a\u4e49\u4e00\u4e2a\u6574\u578b\u8f93\u51fa\u53c2\u6570<br \/>\nCmdSP.Parameters.Append CmdSP.CreateParameter(&#8220;@intIDOut&#8221;, adInteger, adParamOutput, oVal)<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u8fd0\u884c\u5b58\u50a8\u8fc7\u7a0b\uff0c\u5e76\u5f97\u5230\u8fd4\u56de\u8bb0\u5f55\u96c6<br \/>\nSet adoRS = CmdSP.Execute<\/p>\n<p style=\"color: #000000;\">\n&#8216;\u628a\u6bcf\u4e2a\u8bb0\u5f55\u6253\u5370\u51fa\u6765\uff0c\u5176\u4e2d\u7684\u5b57\u6bb5\u662f\u865a\u62df\u7684\uff0c\u53ef\u4ee5\u4e0d\u7528\u7ba1<br \/>\nWhile Not adoRS.EOF<\/p>\n<p style=\"color: #000000;\">\u3000\u3000for each adoField in adoRS.Fields<br \/>\nResponse.Write adoField.Name &amp; &#8220;=&#8221; &amp; adoField.Value &amp; &#8220;&lt;br&gt;&#8221; &amp; vbCRLF<br \/>\nNext<br \/>\nResponse.Write &#8220;&lt;br&gt;&#8221;<br \/>\nadoRS.MoveNext<br \/>\nWend<\/p>\n<p style=\"color: #000000;\">\u3000\u3000&#8217;\u6253\u5370\u4e24\u4e2a\u8f93\u51fa\u503c\uff1a<br \/>\nResponse.Write &#8220;&lt;p&gt;@intIDOut = \u201c &amp; CmdSP.Parameters(&#8220;@intIDOut&#8221;).Value &amp; &#8220;&lt;\/p&gt;&#8221;<br \/>\nResponse.Write &#8220;&lt;p&gt;Return value = &#8221; &amp; CmdSP.Parameters(&#8220;RETURN_VALUE&#8221;).Value &amp; &#8220;&lt;\/p&gt;&#8221;<\/p>\n<p style=\"color: #000000;\">\n&#8216;\u5927\u626b\u9664<br \/>\nSet adoRS = nothing<br \/>\nSet CmdSP.ActiveConnection = nothing<br \/>\nSet CmdSP = nothing<br \/>\n%&gt;<\/p>\n<p style=\"color: #000000;\">\u3000\u3000\u5728asp\u4e2d\u8c03\u7528sql server\u7684\u5b58\u50a8\u8fc7\u7a0b\u53ef\u4ee5\u52a0\u5feb\u7a0b\u5e8f\u8fd0\u884c\u901f\u5ea6<\/p>\n<p style=\"color: #000000;\">\u3000\u30001.\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u7684\u4e00\u822c\u65b9\u6cd5<br \/>\n\u5148\u5047\u8bbe\u5728sql server\u4e2d\u6709\u4e00\u5b58\u50a8\u8fc7\u7a0bdt_users\uff1a<br \/>\nCREATE PROCEDURE [dbo].[dt_users]\nAS<br \/>\nselect * from users<br \/>\nreturn<br \/>\nGO<br \/>\n\u7b2c\u4e00\u79cd\u65b9\u6cd5\u662f\u4e0d\u5229\u7528command\u5bf9\u8c61\uff0c\u76f4\u63a5\u7528recordset\u5bf9\u8c61<br \/>\nset rs=server.createobject(&#8220;adodb.recordset&#8221;)<br \/>\nsql=&#8221;exec dt_users&#8221;<br \/>\nrs.open sql,conn,1,1\u00a0 \u8fd9\u6837\u5c31\u53ef<br \/>\n\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u662f\u5229\u7528command\u5bf9\u8c61<br \/>\nset comm=server.createobject(&#8220;adodb.command&#8221;)<br \/>\ncomm.commantype=4<br \/>\nset comm.activeconnection=conn<br \/>\ncomm.commandtext=&#8221;dbo.dt_users&#8221;<br \/>\nset rs=server.createobject(&#8220;adodb.recordset&#8221;)<br \/>\nrs.open comm,,1,1<\/p>\n<p style=\"color: #000000;\">\u3000\u30002.\u7ed9\u5b58\u50a8\u8fc7\u7a0b\u4f20\u9012\u53c2\u6570<br \/>\n\u5982\u679c\u5b58\u50a8\u8fc7\u7a0b\u4e2d\u4e0d\u7528\u53c2\u6570\uff0c\u800c\u662f\u5355\u4e00\u7684sql\u8bed\u53e5\uff0c\u8fd8\u663e\u793a\u4e0d\u51fa\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u7684\u4f18\u52bf\uff01<br \/>\n\u6bd4\u5982\u8bf4\u4e00bbs\u7684\u67e5\u8be2\uff0c\u53ef\u4ee5\u6309\u4f5c\u8005\u548c\u4e3b\u9898\u67e5\u8be2\uff01\u5219\u53ef\u4ee5\u5efa\u7acb\u5b58\u50a8\u8fc7\u7a0b\u5982\u4e0b\uff1a<br \/>\n\u53c2\u6570keyword\u4e3a\u5173\u952e\u5b57\uff0cchoose\u662f\u9009\u62e9\u67e5\u8be2\u7684\u65b9\u6cd5\u3002<br \/>\nCREATE PROCEDURE [dbo].[dt_bbs]\n@keyword varchar(20)=null,<br \/>\n@choose int=null<br \/>\nas<br \/>\nif @choose=1<br \/>\nselect * from bbs where name like @keyword<br \/>\nelse<br \/>\nselect * from bbs where subject like @keyword<br \/>\nreturn<br \/>\ngo<br \/>\n\u8fd9\u6837\u6211\u4eec\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u65f6\u53ea\u9700\u5c06\u53c2\u6570\u4f20\u9012\u8fc7\u53bb\u5c31\u884c\u4e86\uff0c\u800c\u7701\u53bb\u5728asp\u4e2d\u6765\u5199\u4e00\u6bb5\u7a0b\u5e8f<br \/>\n\u7528\u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a<br \/>\nset rs=server.createobject(&#8220;adodb.recordset&#8221;)<br \/>\nsql=&#8221;exec dt_bbs &#8216;&#8221;&amp;keyword&amp;&#8221;&#8216;,&#8221;&amp;choose&amp;&#8221;&#8221;<br \/>\nrs.open sql,conn,1,1<br \/>\n\u7528\u7b2c\u4e8c\u79cd\u65b9\u6cd5:<br \/>\nset comm=server.createobject(&#8220;adodb.command&#8221;)<br \/>\ncomm.commantype=4<br \/>\ncomm.Parameters.append comm.CreateParameter(&#8220;@keyword&#8221;,adChar,adParamInput,50,keyword)<br \/>\ncomm.Parameters.append comm.CreateParameter(&#8220;@keyword&#8221;,adInteger,adParamInput,,choose)<br \/>\nset comm.activeconnection=conn<br \/>\ncomm.commandtext=&#8221;dbo.dt_bbs&#8221;<br \/>\nset rs=server.createobject(&#8220;adodb.recordset&#8221;)<br \/>\nrs.CursorType=3<br \/>\nrs.open comm,,1,1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u8fd9\u4e5f\u662f\u6700\u7b80\u5355\u7684\u65b9\u6cd5,\u4e24\u4e2a\u8f93\u5165\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c\uff1a set conn&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,6],"tags":[44],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-asp","category-6","tag-44"],"_links":{"self":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=520"}],"version-history":[{"count":1,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":521,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions\/521"}],"wp:attachment":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}