当前位置:编程学习 > C#/ASP.NET >>

悲观观定SQL Server和Oracle

答案: 

/*

 author:wuxiuxiang;
Email:imessage@126.com

*/

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);
           SqlDataAdapter da 
= new SqlDataAdapter(cmd);
在DataGrid中,使鼠标到达的行和列显示不同的颜色
下一个:DataGrid使用技巧(一)-------如何屏蔽单元格输入

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,