悲观观定SQL Server和Oracle,悲观观定SQL Server和Oracle
【 tulaoshi.com - ASP.NET 】
using System.Data;
namespace com.cuc.wu.example

{
public class class1
{
//For SQL Server 需要与Connection相关的一个Transaction的隔离级别为 //Repeatable Read或Serializable,对于Oracle,在Command中使用select for update即可
public void LockedSQLDataRow()
{
DataSet ds = new DataSet();
SqlConnection sconn = new SqlConnection("server=localhost;uid=sa;pwd=sa;database=pubs");
sconn.Open();
SqlTransaction tx = new sconn.BeginTransaction(IsolationLevel.Serializable);
SqlCommand cmd = new SqlCommand("select * from authors",conn,tx);来源:http://www.tulaoshi.com/n/20160129/1486529.html
看过《悲观观定SQL Server和Oracle》的人还看了以下文章 更多>>