SqlServer´´½¨Óû§Ê±Ä¬ÈϾ͸³ÓèÁËÒ»¸öpublic½ÇÉ«¡£
ÎÒÊÇ·ñ¿ÉÒÔ´´½¨Ò»¸öÓû§£¬ÈÃÕâ¸öÓû§Ö»ÓеǼµÄȨÏÞ£¬Ã»ÓÐÆäËûµÄȨÏÞ£¡
ÎÒµÄÊý¾Ý¿âÊÇSqlServer2000
SQL code:
--Ìí¼ÓµÇ¼ wh1,ÉèÖÃÃÜÂëΪ123,ĬÈÏÊý¾Ý¿â
EXEC sp_addlogin 'wh1','123'
ÕâÑù´´½¨ÒÔºó¾ÍÖ»ÓеǼµÄȨÏÞ
ÒýÓÃ
public½ÇÉ«²»¿ÉÒÔÈ¥µôµ ......
C# code:
//Ôö¼ÓÒ»ÌõÊý¾Ý¡£¡£¡£¡£¡£
public int AddAdmin(string UID, string PWD)
{
string sql = "insert into Admin(_uid,_pwd)values(@UID,@PWD)";
SqlParameter[] parameters = new SqlParameter[2];
parameters[0] = new SqlParameter("@UID", UID);
......
´ó¼ÒºÃÏÖÔÚÓÐ Ò»¸öÎÞÏÞ¼¶·ÖÀà±í ÎÒÏë²éѯÈÎÒâÒ»¸ö·ÖÀàÏÂÃæËùÓеÄ×ÓÀࣨÎÞÏÞ¼¶µÄ£©¸ÃÈçºÎʵÏÖÄØ
ÓÃÊ÷Óڽṹ
http://blog.csdn.net/soft_wsx/archive/2009/09/04/4521091.aspx
½á¹¹£¬¼Ç¼
......
Ö÷¼üÊÇuniqueidentifierÀàÐÍ£¬Ã»ÓÐ×ÔÔö×ֶΡ£¡£
ÕâÑùÓ¦¸ÃÔõô»ñÈ¡£¿
L@_@K
SQL code:
SELECT ISNULL(SCOPE_IDENTITY(), -1) AS [SCOPE_IDENTITY]
°´Ê±¼äÅÅÐò
»ò
guid²»Òª×Ô¶¯Éú³É
ÔÚÌí¼ÓµÄʱºò ÔÚ´úÂëÀïн¨Ò»¸öguid
µ¹ÐðÈ¡×îºóµÄÒ»Ìõ¼Ç¼
¹Ø×¢
ÒýÓÃ
µ¹ÐðÈ¡×îºóµÄÒ»Ìõ¼Ç ......
ÏÂÃæÊÇÎÒµÄͳ¼ÆÐÅÏ¢£º
¿Í»§¶ËÖ´ÐÐʱ¼ä 10:28:48
²éѯÅäÖÃÎļþͳ¼ÆÐÅÏ¢
INSERT¡¢DELETE ºÍ UPDATE Óï¾äµÄÊýÄ¿ 0 0.0000
INSERT¡¢DELETE »ò UPDATE Óï¾äÓ°ÏìµÄÐÐÊý 0 0.0000
SELECT Óï¾äµÄÊýÄ¿ 1 1.0000
SELECT Óï¾ä·µ»ØµÄÐÐÊý 264 264.0000
ÊÂÎñÊý ......
SqlServerÖÐ×Ö·ûÐÍת»»ÎªÊý×ÖÐͳöÏîµÄÎÊÌâ
select @rno=rno from deleted;
convert(numeric,@rno);
@rno=@rno/1000;
ÏûÏ¢ 156£¬¼¶±ð 15£¬×´Ì¬ 1£¬¹ý³Ì t2£¬µÚ 11 ÐÐ
¹Ø¼ü×Ö 'convert' ¸½½üÓÐÓï·¨´íÎó¡£
select @rno=rno from deleted;
set @rno = cast(@rno as numeric)
......