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

C# Ö´ÐÐSQLÊÂÎñʵÀý´úÂë

 [C#]
public void RunSqlTransaction(string myConnString)
{
    SqlConnection myConnection = new SqlConnection(myConnString);
    myConnection.Open();
    SqlCommand myCommand = myConnection.CreateCommand();
    SqlTransaction myTrans;
    // Start a local transaction
    myTrans = myConnection.BeginTransaction();
    // Must assign both transaction object and connection
    // to Command object for a pending local transaction
    myCommand.Connection = myConnection;
    myCommand.Transaction = myTrans;
    try
    {
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, ´Description´)";
      myCommand.ExecuteNonQuery();
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, ´Description´)";
      myCommand.ExecuteNonQuery();
      myTrans.Commit();
      Console.WriteLine("Both records are written to database.");
    }
    catch(Exception e)
    {
      try
      {
        myTrans.Rollback();
      }
      catch (SqlException ex)
      {
        if (myTrans.Connection != null)
        {
          Console.WriteLine("An exception of type " + ex.GetType() +
                       


Ïà¹ØÎĵµ£º

sql ½»²æ±í

½»²æ±íÓï¾äµÄʵÏÖ:
¡¡¡¡ÓÃÓÚ:½»²æ±íµÄÁÐÊýÊÇÈ·¶¨µÄ
¡¡¡¡select name,sum(case subject when 'Êýѧ' then source else 0 end) as 'Êýѧ',
¡¡¡¡sum(case subject when 'Ó¢Óï' then source else 0 end) as 'Ó¢Óï',
¡¡¡¡sum(case subject when 'ÓïÎÄ' then source else 0 end) as 'ÓïÎÄ'
¡¡¡¡from test
¡¡¡¡group by name ......

sql 2000MMC ²»ÄÜ´ò¿ªÎļþ

 MMC ²»ÄÜ´ò¿ªÎļþ C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC¡£¿ÉÒÔÔ­ÒòÊÇÎļþ²»´æÔÚ£¬²»ÊÇÒ»¸öMMC¿ØÖÆ̨£¬»òÕßÓúóÀ´MMC°æ±¾´´½¨£¬Ò²ÐíҲûÓзÃÎÊ´ËÎļþµÄ×㹻ȨÏÞ¡£
½â¾ö·½·¨£º
ÖØд´½¨´ËÎļþ£¬ÔËÐжԻ°¿òÖÐÊäÈë:mmc
1) ¿ØÖÆ̨-->Ìí¼Ó/ɾ³ý¹ÜÀíµ¥Ôª-->Ìí¼ ......

ÔÚSQLÖÐSelectÓï¾äµÄÖ´ÐÐ˳Ðò

ÔÚSQLÖÐSelectÓï¾äµÄÖ´ÐÐ˳ÐòÈçÏ£º
(1)from×Ӿ䣬×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý
(2)WHERE×Ӿ䣬¸øÓèÖ¸¶¨Ìõ¼þ¶Ô¼Ç¼½øÐÐɸѡ
(3)GROUP BY×Ӿ䣬½«Êý¾Ý»®·ÖΪ¶à¸ö×é
(4)ʹÓþۼ¯º¯Êý½øÐмÆËã
(5)ʹÓÃHAVING×Ó¾äɸѡ·Ö×é
(6)¼ÆËãËùÓбí´ïʽ
(7)ʹÓÃORDER BY¶Ô½á¹û½øÐÐÅÅÐò ......

VB,C#ʹÓÃVCµÄ.libºÍ.hÎļþ

——————————————————————————————————
ÔÚc#ÖÐÈçºÎʹÓÃÒÔÇ°c++µÄ.lib¿âºÍ.hÍ·Îļþ
zhujiang_1977£¨Öì½­ ......

SQL×¢È멶´½Ó´¥

 Òý×Ôhttp://www.05112.com/Article/200908/26674.html
ÍøÕ¾SQL×¢È멶´È«½Ó´¥£¨¸ß¼¶Æª£©
ÎÄÕÂÕûÀí·¢²¼£ººÚ¿Í·çÔÆ ÄÚÈݹØ×¢¶È£º
291 ¸üÐÂʱ¼ä£º2009-8-15 6:36:47
¿´ÍêÈëÃÅƪºÍ½ø½×ƪºó£¬ÉÔ¼ÓÁ·Ï°£¬ÆƽâÒ»°ãµÄÍøÕ¾ÊÇûÎÊÌâÁË¡£µ«Èç¹ûÅöµ½±íÃûÁÐÃû²Â²»µ½£¬»ò³ÌÐò×÷Õß¹ýÂËÁËһЩÌØÊâ×Ö·û£¬ÔõôÌá¸ß×¢ÈëµÄ³É¹¦ÂÊ£¿Ôõ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ