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

SQL Server 2005´æ´¢¹ý³Ì¿ª·¢µÄÒ»µã¾­Ñé

1¡¢  ´æ´¢¹ý³Ì
1£©  ¾¡Á¿½«´úÂë¶Î·Åµ½TRY…CATCH…¡£
µ«·²Ê¹ÓÃC#д¹ý´úÂëµÄÈË£¬¶¼ÖªµÀC#ÖÐTRY…CATCH…µÄÔËÐкͳö´íÌøתÂß¼­£¬¶øSQL Server2005ÖУ¬ÆäÔËÐкͳö´íÌøתÂß¼­ÓëÔÚC#ÖÐÊÇÒ»Öµġ£TRY…CATCH…ÊÇSQL Server2005ÖÐÐÂÔöµÄ£¬¹¦ÄÜÇ¿´ó£¬ÇҺܺÃÓá£
2£© ¶¨Òå±äÁ¿Ê±£¬¿ÉÒÔʹÓÃǰ׺µÄ·½Ê½±êʶ±äÁ¿µÄÀàÐÍ¡£ÔÚSQL ServerÖпª·¢»ù±¾ºÍÔÚ¼Çʱ¾Öпª·¢²î²»Á˶àÉÙ£¬Ã»ÓÐÔÚVisual StudioµÄIDEÖÐÄÇôÊæ·þ£¬»¹ÓÐÖÇÄܸÐÖªÌáʾ£¬ËùÒÔ±äÁ¿Òª¾¡Á¿¼òµ¥Çå³þ¡£ÈçÒª¶¨ÒåÒ»¸öbitÐͺÍÒ»¸öintÐ͵ıäÁ¿£¬¿ÉÒÔ°´ÕÕÒÔϵķ½Ê½Ìí¼Óǰ׺¡£DECLARE @b_NewTran bit; DECLARE @n_ErrorLogID int;
3£©  outÐ͵IJÎÊýÒ»ÉÏÀ´¾ÍÓ¦¸Ã³õʼ»¯¡£
4£©  µ±È»£¬×¢ÊÍÊDZز»¿ÉÉٵģ¬¶øÇÒÔ½ÏêϸԽºÃ¡£
5£©  ¾¡Á¿±ÜÃâʹÓÃÓαꡣ¾Ý˵ÓαêµÄЧÂʽϲÔÚ¶¨ÒåÓαêʱ£¬Òª¼ì²éÕâ¸öÓα꣨ÈçORDERLINE_CURSOR£©ÊÇ·ñÒѾ­´æÔÚ£¬¿ÉÒÔʹÓÃÈçÏ´úÂë¡£
 IF CURSOR_STATUS('global',N'ORDERLINE_CURSOR')<>-3  
    BEGIN
       DEALLOCATE ORDERLINE_CURSOR
    END
    Èç¹ûÒ»¸öÓαêÒѾ­´æÔÚ£¬ÔòÓ¦ÏȽ«ÆäÊÍ·Å¡£È»ºóÔÙ¶¨Òå¡£
    DECLARE ORDERLINE_CURSOR CURSOR FOR...
 ÓαêÓÃÍêºó£¬Ó¦¼°Ê±¹Ø±Õ£¬²¢ÊÍ·Å¡£
     CLOSE ORDERLINE_CURSOR
     DEALLOCATE ORDERLINE_CURSOR 
 Óαê¿ÉÒÔ×÷Ϊ²ÎÊý´«µÝ£¬ÈçSP1µ÷ÓÃSP2£¬²¢´ÓSP2Öзµ»ØÒ»¸öÓαêÀàÐ͵IJÎÊý¡£ÔÚSP2ÖеIJÎÊýÓ¦¶¨Òå  Îª @xxx_CURSORCURSOR VARYING OUTPUT£¬SP1µ÷ÓÃSP2ʱ£¬Ïȶ¨ÒåÒ»¸öCURSORÀàÐ͵ıäÁ¿DECLARE @xxx_CURSOR CURSOR£¬È»ºóµ÷ÓÃSP2 SP2 @xxx_CURSOR OUTPUT 
6£© EXECÓëSP_EXECUTESQLµÄÓ÷¨¡£ËûÃǶ¼¿ÉÒÔÓÃÓÚÖ´ÐÐÒ»¸ö¶¯Ì¬SQLÓï¾ä¡£µ«ÊǶÔÓÚ¶¯Ì¬SQLÓï¾äÖаüº¬ÁË·µ»ØÖµµÄÇé¿ö£¬Ö»ÓÐÓÃSP_EXECUTESQLÁË¡£±ÈÈçÖ´ÐÐÒ»¸ö¶¯Ì¬Ìõ¼þµÄ¼Ç¼ÐÐÊý²éѯ£¬Ïȹ¹ÔìSQLÓï¾ä£ºSET @c_Sql = 'SELECT @n_RowsCount =COUNT(1) from '+ @c_TableName¡£ÆäÖÐ@n_RowsCountÊÇÒ»¸ö±äÁ¿£¬ÎÒÏ£Íûͨ¹ýËüÈ¡µÃ


Ïà¹ØÎĵµ£º

³õѧPL/SQL Óαê

1,ÏÔʾÓαêµÄ²Ù×÷
  
(1) ¶¨ÒåÓαê
      ¸ù¾Ý²éѯµÄÊý¾ÝÇé¿ö£¬ÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö¶¨ÒåÓα꣬Ó﷨Ϊ£º
         cursor cursor_name is select_statement;
×¢Ò⣺
     Óαê±ØÐëÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö½øÐж¨Ò壻 ......

SQL ServerÖÐÁÙʱ±íÓë±í±äÁ¿µÄÇø±ð

ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾­³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£ ......

ͨ¹ýÅú´¦Àí£¬ÊµÏÖSQL ServerÊý¾Ý¿â¶¨ÆÚ±¸·Ýµ½ftp

@echo off
rem --------------------- ÅäÖÃ: ftpÉÏ´«²ÎÊý,¼°±¾µØÎļþĿ¼(Êý¾Ý¿â±¸·ÝµÄÁÙʱĿ¼)-----------------
set "PUT_FTP_SERVER=192.168.1.100"
set "PUT_FTP_PORT=21"
set "PUT_FTP_USERNAME=ftpuser"
set "PUT_FTP_PASSWORD=ftppasswd"
set "PUT_DIR=/"
set "LOCAL_DIR=D:\sql_dbbackup\"
rem ---------- ......

SQLÓï¾äÐÔÄܵ÷ÕûÔ­Ôò

 Ò»¡¢ÎÊÌâµÄÌá³ö
    ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳÌύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½ ......

QtÊý¾Ý¿â£¨ËÄ£©ÀûÓÃQSqlQueryÀàÖ´ÐÐSQLÓï¾ä£¨¶þ£©


±¾ÎÄÕÂÔ­´´ÓÚwww.yafeilinux.com ×ªÔØÇë×¢Ã÷³ö´¦¡£
½Ó×ÅÉÏһƪ½Ì³Ì¡£
¶þ£¬ÔÚSQLÓï¾äÖÐʹÓñäÁ¿¡£
ÎÒÃÇÏÈ¿´ÏÂÃæµÄÒ»¸öÀý×Ó£¬½«“²éѯ”°´Å¥µÄ²Ûº¯Êý¸ü¸ÄÈçÏ£º
void Widget::on_pushButton_clicked()
{
    QSqlQuery query;
    query.prepare(“insert i ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ