{"id":285,"date":"2007-11-15T21:49:00","date_gmt":"2007-11-15T21:49:00","guid":{"rendered":"http:\/\/www.sincebirth.cn\/?p=285"},"modified":"2007-11-15T21:49:00","modified_gmt":"2007-11-15T21:49:00","slug":"subsonic%e7%9a%84%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/sincebirth.space\/?p=285","title":{"rendered":"SubSonic\u7684\u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c"},"content":{"rendered":"<div id=\"blog_text\" class=\"cnt\">\n<p>\u4e00\u4e2a\u4e0d\u751a\u5b8c\u5584\u7684\u5b58\u50a8\u8fc7\u7a0b\uff1a<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\u5f00\u59cb&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>&#8212; ================================================<br \/>\n&#8212; \u4f5c\u7528\u662f\u4ee3\u66ff\u81ea\u52a8\u589e\u957f\u578b\u7684ID\uff0c\u8fd9\u6837\u4fbf\u4e8e\u5206\u8868\u7684\u7ef4\u62a4<br \/>\n&#8212; ================================================<\/p>\n<p>set ANSI_NULLS ON<br \/>\nset QUOTED_IDENTIFIER ON<br \/>\ngo<\/p>\n<p>ALTER PROCEDURE [dbo].[GenerateRUID]<\/p>\n<p> @tblName varchar(50),<br \/>\n @currentnumber int OUTPUT<\/p>\n<p>AS<br \/>\n SET NOCOUNT ON<br \/>\n Declare @tempnumber int<\/p>\n<p>Begin<\/p>\n<p> SELECT @tempnumber= CurrentNumber<br \/>\n FROM Ruid<br \/>\n WHERE (TableName = @tblName) <\/p>\n<p> SET @tempnumber=@tempnumber+1 <br \/>\n&nbsp;&nbsp;<br \/>\n Update Ruid<br \/>\n SET CurrentNumber=@tempnumber<br \/>\n Where TableName=@tblName<\/p>\n<p> SET @currentnumber=@tempnumber<br \/>\nEND<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u4ee5\u4e0b\u662f\u5229\u7528SubSonic2.0\u4f7f\u7528\u8be5\u5b58\u50a8\u8fc7\u7a0b\u7684\u4ee3\u7801\uff1a<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u4ee3\u7801\u5f00\u59cb&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>public static int GetRUID(string tblName)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  StoredProcedure spd = new StoredProcedure(&quot;GenerateRUID&quot;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  spd.Command.AddParameter(&quot;@tblName&quot;, tblName);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  spd.Command.AddOutputParameter(&quot;@currentnumber&quot;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  spd.Execute();<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  int currentnumber = int.Parse(spd.OutputValues[0].ToString());<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  return currentnumber;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  }<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\u4ee3\u7801\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><a href=\"http:\/\/www.subsonicproject.com\/\">www.subsonicproject.com<\/a><\/p>\n<p>\u5f15\u7528\uff1a<a href=\"http:\/\/www.sim-zone.cn\/?uid-6-action-viewspace-itemid-548\">http:\/\/www.sim-zone.cn\/?uid-6-action-viewspace-itemid-548<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u4e2a\u4e0d\u751a\u5b8c\u5584\u7684\u5b58\u50a8\u8fc7\u7a0b\uff1a &#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &hellip; <a href=\"https:\/\/sincebirth.space\/?p=285\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cSubSonic\u7684\u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c\u201d<\/span><\/a><\/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":[],"class_list":["post-285","post","type-post","status-publish","format-standard","hentry","category-all"],"views":1082,"_links":{"self":[{"href":"https:\/\/sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts\/285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sincebirth.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sincebirth.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285"}],"version-history":[{"count":0,"href":"https:\/\/sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts\/285\/revisions"}],"wp:attachment":[{"href":"https:\/\/sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}