ADO组件的LockType怎么使用!谁能翻译一下!ltUnspecified A specific lock type has not been specified or determined.ltReadOnly Read-only; the current execution cannot modify data.ltPessimistic Pessimistic locks; locks instantiated on a record-by-record basis when edit mode is applied to a record.ltOptimistic Optimistic locks; locked are initiated on a record-by-record asis,but  only when updates are applied and a record is being updated.ltBatchOptimistic Optimistic batch updates; used for batch update mode rather than immediate update mode.

解决方案 »

  1.   

    procedure TForm1.FormShow(Sender: TObject);
    begin
      ADODataSet1.LockType:=ltBatchOptimistic;
    end;procedure TForm1.ButtonCommitClick(Sender: TObject);
    begin
      ADODataSet1.UpdateBatch;
    end;procedure TForm1.ButtonCancelClick(Sender: TObject);
    begin
      ADODataSet1.CancelUpdates;
    end;
      

  2.   

    adLockReadOnly1缺省值,Recordset对象以只读方式启动,无法运行AddNew、Update及Delete等方法
    adLockPrssimistic2当数据源正在更新时,系统会暂时锁住其他用户的动作,以保持数据一致性
    adLockOptimistic3当数据源正在更新时,系统并不会锁住其他用户的动作,其他用户可以对数据进行增、删、改的操作
    adLockBatchOptimistic4当数据源正在更新时,其他用户必须将CursorLocation属性改为adUdeClientBatch才能对数据进行增、删、改的操作