当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 悲观观定SQL Server和Oracle

ASP.NET
细细品味ASP.NET(一)
细细品味ASP.NET(二)
细细品味ASP.NET(三)
细细品味ASP.NET(四)
细细品味ASP.NET(五)
用asp.net和xml做的新闻更新系统(1)
用asp.net和xml做的新闻更新系统(2)
用asp.net和xml做的新闻更新系统(3)
十天学会ASP.net(1)
十天学会ASP.net(2)
十天学会ASP.net(3)
十天学会ASP.net(4)
十天学会ASP.net(5)
十天学会ASP.net(6)
十天学会ASP.net(7)
十天学会ASP.net(8)
十天学会ASP.net(9)
十天学会ASP.net(10)
ASP.NET创建XML Web服务全接触(1)
ASP.NET创建XML Web服务全接触(2)

ASP.NET 中的 悲观观定SQL Server和Oracle


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 100 ::
收藏到网摘: n/a


/*
author:wuxiuxiang;Email:[email protected]
*/
using System;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);