Ôõô»ñÈ¡sqlserver×îºó²åÈëÐÐÄÚµÄ×ֶΣ¿
Ö÷¼üÊÇuniqueidentifierÀàÐÍ£¬Ã»ÓÐ×ÔÔö×ֶΡ£¡£ ÕâÑùÓ¦¸ÃÔõô»ñÈ¡£¿
L@_@K SQL code: SELECT ISNULL(SCOPE_IDENTITY(), -1) AS [SCOPE_IDENTITY] °´Ê±¼äÅÅÐò »ò guid²»Òª×Ô¶¯Éú³É ÔÚÌí¼ÓµÄʱºò ÔÚ´úÂëÀïн¨Ò»¸öguid µ¹ÐðÈ¡×îºóµÄÒ»Ìõ¼Ç¼ ¹Ø×¢ÒýÓà µ¹ÐðÈ¡×îºóµÄÒ»Ìõ¼Ç¼ ÔõôŪ£¿¾ßÌåµã¡£¡£ SQL code: SELECT ISNULL(SCOPE_IDENTITY(), -1) AS [SCOPE_IDENTITY] Õâ¸öËƺõ²»Ðа¡¡£¡£ÒýÓà °´Ê±¼äÅÅÐò »ò guid²»Òª×Ô¶¯Éú³É ÔÚÌí¼ÓµÄʱºò ÔÚ´úÂëÀïн¨Ò»¸öguid ¶÷ ÎÒÏÖÔÚÏ£ÍûinsertÍêºó·µ»ØÕâ¸öguid £¨´æ´¢¹ý³ÌÀ µ«ÊDzåÈëÍêÓÃʱ¼äselect²»µ½¸Õ²åÈëµÄ£¬Õâ¸öÎÊÌâÔõô´¦Àí£¿ À´Ñ§Ï°Ñ§Ï°~ °Ñ±íÔö¼ÓÒ»¸ö×ÔÔö×ֶβ»¾ÍºÃ°ìÁËÂð ±íÉè¼ÆÎÊÌâ ͬÒâÂ¥ÉÏ£¬ Ï°¹ßÐÔ½«±í¼ÓÉÏÒ»¸ö×ÔÔö ID, ×÷ΪΨһ±êʶ£¬ÊÇÒ»¸öºÃÏ°¹ß¡£ Ö÷¼ü¿ÉÒÔ¶à¸ö ͬͬͬ¥ÉÏ,SELECT * from table WHERE Id = @@IDENTITY
Ïà¹ØÎÊ´ð£º
´úÂ룺 try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con= DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost: ......
Êý¾Ý10WÌõÒÔÉÏ,wm6.5ƽ̨,ÄÚ´æÓÐÏÞ C# code: private void connserver() { Cursor.Current = Cursors.WaitCursor; try { ......
ÎÒ´Ó΢Èí¹ÙÍøÏÂÔصÄdriverÔõôÊǸöhtmlÎļþ˸øÖ¸Õýһϣ¬ÔÚÄÄÀïÏ£¬¾ßÌå·¾¶¼°²Ù×÷²½Öè Ò»°ã¹ÜÍøÏÂÔض¼ÒªÒ»²½Ò»²½×ßÏÂÈ¥£¬Èç¹ûÄã¹ýÔçÁí´æΪµÄ»°£¬µÃµ½µÄÍùÍùÊÇlicenseÄÇÒ»Ò³¡£ ÎҼǵĺÃÏëÔÚ£ºÄãϵÄÄǸöHTMLÎļ ......
C# code: //Ôö¼ÓÒ»ÌõÊý¾Ý¡£¡£¡£¡£¡£ public int AddAdmin(string UID, string PWD) { string sql = "insert into Admin(_uid,_pwd)values(@UID,@PWD)"; SqlParameter[] p ......