{"id":681,"date":"2011-01-28T10:11:32","date_gmt":"2011-01-28T02:11:32","guid":{"rendered":""},"modified":"2014-03-11T22:36:20","modified_gmt":"2014-03-11T14:36:20","slug":"asp%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2011\/01\/28\/681.htm","title":{"rendered":"ASP\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b"},"content":{"rendered":"<p>MS SQL\u5b58\u50a8\u8fc7\u7a0b<br \/>\nCreate proc sp_join<br \/>\n@result int output,<br \/>\n@email nvarchar(30),<br \/>\n@username nvarchar(15)<br \/>\nAS<\/p>\n<p>&#8212; \u5f00\u59cb\u4e8b\u52a1<br \/>\nBegin Tran<br \/>\nINSERT INTO users(username, email) VALUES(@username, @email)<br \/>\nIF @@ERROR &lt;&gt; 0 GOTO back<\/p>\n<p>INSERT INTO register(username) VALUES(@userName)<br \/>\nIF @@ERROR &lt;&gt; 0 GOTO back<\/p>\n<p>\n&#8212; \u63d0\u4ea4\u4e8b\u52a1<br \/>\nSet @result = 1<br \/>\nCommit Tran<br \/>\nReturn<\/p>\n<p>\n&#8212; \u56de\u6eda\u4e8b\u52a1<br \/>\nback:<br \/>\nSet @result = 0<br \/>\nRollBack Tran<br \/>\nReturn<\/p>\n<p>\u6570\u636e\u5e93\u8fde\u63a5\u4ee3\u7801<br \/>\nSub Command(oCmd)<br \/>\nSet oCmd = Server.CreateObject(&quot;ADODB.Command&quot;)<br \/>\nEnd Sub<\/p>\n<p>Sub Connection(oConn)<br \/>\nSet oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)<br \/>\noConn.Open &quot;Provider=SQLOLEDB;Server=;User ID=;Password=;Database=;&quot;<br \/>\nEnd Sub<\/p>\n<p>Sub Destroy(obj)<br \/>\nIf isObject(obj) Then Set obj = Nothing<br \/>\nEnd Sub<\/p>\n<p>ASP\u8c03\u7528\u4ee3\u7801<br \/>\nDim strEmail, strUserName<br \/>\nDim objCmd, objConn, intResult<\/p>\n<p>strEmail = Request.Form(&quot;email&quot;)<br \/>\nstrUserName = Request.Form(&quot;username&quot;)<\/p>\n<p>&#8216;\u670d\u52a1\u5668\u7aef\u6570\u636e\u9a8c\u8bc1\uff08\u7565\uff09<\/p>\n<p>Command objCmd<br \/>\nConnection objConn<\/p>\n<p>With objCmd<br \/>\n.ActiveConnection = objConn<br \/>\n.CommandType = 4<br \/>\n.CommandText = &quot;sp_join&quot;<br \/>\n.Parameters.Refresh<br \/>\n.Parameters(&quot;@email&quot;) = strEmail<br \/>\n.Parameters(&quot;@username&quot;) = strUserName<br \/>\n.Execute<br \/>\nEnd With<br \/>\nintResult = objCmd.parameters(&quot;@result&quot;)<\/p>\n<p>Destroy objCmd<br \/>\nDestroy objConn<\/p>\n<p>If intResult = 0 Then<br \/>\nResponse.Write(&quot;\u6ce8\u518c\u5931\u8d25&quot;)<br \/>\nElse<br \/>\nResponse.Write(&quot;\u6ce8\u518c\u6210\u529f&quot;)<br \/>\nEnd If <br \/>\n&nbsp;<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5e0c\u671b\u80fd\u8d77\u5230\u629b\u7816\u5f15\u7389\u7684\u4f5c\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MS SQL\u5b58\u50a8\u8fc7\u7a0b Create proc sp_join @result int output, @email nvarchar(30), @username nvarchar(15) AS &#8212; \u5f00\u59cb\u4e8b\u52a1 Begin Tra&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-681","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=681"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/681\/revisions"}],"predecessor-version":[{"id":66524,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/681\/revisions\/66524"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=681"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}