一个程序,同时运行了多个。程序使用ADO控件写数据,代码如下。如果程序同一时间向同一个库写入数据时,就会出现出错。怎样解决不锁的问题.DataBaseAccess = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\Data\BBQ.moa"
  
With Adodc1
      .ConnectionString = DataBaseAccess
      .RecordSource = "Select * from Other where ID=1"
      .Refresh
       If .Recordset.RecordCount > 0 Then 
       .Recordset("Ip")="123"
       .Recordset.Update
       End If
      .Recordset.Close
   End With注:不同一时间写数据就正常

解决方案 »

  1.   

    你试试吧,好用的
    记得要引用ado  
    你只需要在工程/引用 miscrosoft Activex data objects 2.x library 就可以了
    Dim Con As ADODB.Connection
        Dim rs As ADODB.Recordset
        Set Con = New ADODB.Connection
        strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
        Con.Open strCon
        Set rs = New ADODB.Recordset
        '添加记录
        strsql="select * from table"
        rs.Open strsql, Con, adOpenKeyset, adLockOptimistic      
        rs.addnew
           rs!字段1=text1.text
           rs!字段2=text2.text
           ........
        rs.update
        rs.close
        set rs=nothing
      

  2.   

    用adodc绑定太过时了,而且不够灵活,还是用我上面的把