Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

²¶»ñSqlÒì³£

°ïÖúÀïµÄ,Óï·¨:
BEGIN TRY
    { sql_statement | statement_block }
END TRY
BEGIN CATCH
          [ { sql_statement | statement_block } ]
END CATCH
[ ; ]
Òì³£²¿·Ö:
ÔÚ CATCH ¿éµÄ×÷ÓÃÓòÄÚ£¬¿ÉÒÔʹÓÃÒÔÏÂϵͳº¯ÊýÀ´»ñÈ¡µ¼Ö CATCH ¿éÖ´ÐеĴíÎóÏûÏ¢£º
ERROR_NUMBER() ·µ»Ø´íÎóºÅ¡£
ERROR_SEVERITY() ·µ»ØÑÏÖØÐÔ¡£
ERROR_STATE() ·µ»Ø´íÎó״̬ºÅ¡£
ERROR_PROCEDURE() ·µ»Ø³öÏÖ´íÎóµÄ´æ´¢¹ý³Ì»ò´¥·¢Æ÷µÄÃû³Æ¡£
ERROR_LINE() ·µ»Øµ¼Ö´íÎóµÄÀý³ÌÖеÄÐкš£
ERROR_MESSAGE() ·µ»Ø´íÎóÏûÏ¢µÄÍêÕûÎı¾¡£ ¸ÃÎı¾¿É°üÀ¨ÈκοÉÌæ»»²ÎÊýËùÌṩµÄÖµ£¬È糤¶È¡¢¶ÔÏóÃû»òʱ¼ä¡£


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

SQLɾ³ýÖ¸¶¨×Ö¶ÎÎÊÌâ

¸üÐÂÏÂÎÊÌ⣺
񡜧TBL_Info
×ֶΣº
    infoId int
    title  varchar(20)
    Content  text
    byUser  varchar(20)
    createTime datetime
1¡¢ÈçºÎɾ³ý±íÖÐÊý¾ÝÏàͬµÄÊý¾ÝÄØ£¿£¨Ö÷¼ü³ýÍ⣩
2¡¢ÈçºÎɾ³ýÊý¾Ý±íÖÐij¸ö×Ö¶ÎÊý¾ÝÏàÍ ......

ADO.NETÖеÄsqlÁ¬½Ó

using System.Data;            // Use ADO.NET namespace
using System.Data.SqlClient;  
 SqlConnection thisConnection = new SqlConnection(
      &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ