string s = "Data Source=200.200.0.244;User ID=sa;Password= ;Initial Catalog=FSDBMR; ";//指定连接
                    con = new SqlConnection(s);
                    con.Open();
                 
                  
                    string sql = "SELECT * from TT WITH (HOLDLOCK)";                                       sda = new SqlDataAdapter(sql, con);
                    DataSet ds = new DataSet();
                    sda.Fill(ds, "Table1");//将数据表的内容填充到sda
                    this.dataGridView1.DataSource = ds.Tables[0];  //设置数据源
怎么对TT进行加锁,使别人不能更改此表。

解决方案 »

  1.   

    看我的答复,在11楼!
    http://topic.csdn.net/u/20100616/17/4586bea9-04e2-4e10-9e74-613f8d70987c.html?14831
      

  2.   

    Public Shared strCon As String = "Driver={Progress OpenEdge 10.1C driver};DB=mfgsys;UID=sysprogress;PWD=sysprogress;HOST=192.168.0.9;PORT=9070;DIL=READ COMMITTED;"
      

  3.   

     string s = "Data Source=200.200.0.244;User ID=sa;Password= ;Initial Catalog=FSDBMR; ";//指定连接
                        con = new SqlConnection(s);                    string sql = "SELECT * from TT WITH (HOLDLOCK)";                    SqlCommand lockCmd = new SqlCommand(sql, con);                    if (con.State == ConnectionState.Closed)                        con.Open();                    lockCmd.ExecuteNonQuery();
                        sda = new SqlDataAdapter("select * from TT", con);
                        DataSet ds = new DataSet();
                        sda.Fill(ds, "Table1");//将数据表的内容填充到sda
                        this.dataGridView1.DataSource = ds.Tables[0];  //设置数据源             我这样改了之后还是能插入数据啊????55555555