如题.

解决方案 »

  1.   

    他有X锁和U锁等概念,
    还有Row锁,Index锁等概念
      

  2.   

    ADO.NET c# 
    比如:
    update employe set employee.salary=1.5 * salary where comp='y' and dept='x'这样用事务更新上面操作是对总个表(empoyee)锁住 还是 只锁住 comp='y' and dept='x'的纪录?
      

  3.   

    sql锁

    参考
      

  4.   

    可以設定的隔離級別分別為:
    (1)ReadUncommitted
    (2)ReadCommitted
    (3)RepeatableRead
    (4)Serializable
    (5)Snapshot
    (6)Unspecified
    (7)Chaos
      

  5.   

    Mengsuo
    如果在sql 语句上加上:update employe with(rowlock) set employee.salary=1.5 * salary where comp='y' and dept='x' 
    然后用C# 更新 是不是只锁行了? 但我刚才测试了没效果 
    我的程序(分为两个部分 web 和 Console )Console 这样就会有两个进程同时更新同一张表 .不一会就出现了死锁.  public int ExcuteSQLTran(string strSql, ArrayList ParametersList)
        {
            SqlConnection myConn = new SqlConnection(_CString);
            SqlCommand myComm = new SqlCommand();
            SqlTransaction myTrans = null;
            try
            {
                myComm.CommandTimeout = cmdtimeout;
                if (myConn.State == ConnectionState.Closed)
                    myConn.Open();
                myTrans = myConn.BeginTransaction();
                int i = 0;
                  foreach (object Parameters in ParametersList)
                {
                     SqlParameter[] cmdParms = (SqlParameter[])Parameters;
                    createCommand(myConn, myComm, myTrans, strSql, cmdParms);
                    i += myComm.ExecuteNonQuery();
                    myComm.Parameters.Clear();
                }  
                myTrans.Commit();
                return i;
            }
            catch (Exception ex)
            {
                myTrans.Rollback();
                throw ex;
            }
            finally
            {
                myTrans.Dispose();
                myComm.Dispose();
                if (myConn.State == ConnectionState.Open)
                    myConn.Close();
            }
        }
      

  6.   

    sqlserver 按行锁定
    oracle 按单元格锁定
    这个与事物没关系,更新删除操作都是这么锁。
      

  7.   

    http://msdn.microsoft.com/zh-cn/library/ms190615.aspx