Why do you report a real-time error 7004 when using set DataGrid.DataSource = RescordSet, the collection cannot be used as a lab

xiaoxiao2021-03-06  16

If you set the CursorLocation property to AduseClient, you only support the settings of the ADUSSTATIC. If you set it up

The value does not cause errors and will use the closest supported CURSORTYPE. AduseStatic supports properties and methods of all RecordSet

The adusestatic value is 3 static cursors. You can use a static copy of the record collection of data or generating a report. In addition, it is not visible to the addition, changes or deletions made by other users.

'If you set the CursorLocation property to the AduseServer server cursor to support the vast majority of cursor operations because the server cursor does not support all Transact-SQL statements or batch, customer cursors are often only used as server cursors.

Aid.

AdadDNEW can add new records using the AddNew method. AdapProxPosition can read and set the absolutePosition and the AbsolutePage properties. AdbookMark can access specific records using the Bookmark property. Addelete can use the delete method to delete records. AdHoldRecords can retrieve multiple records or change the next retrieval location without having to submit all hang changes. AdmovePrevious can use the MoveFirst and MovePrevious methods, and the Move or getRows method will bits

When moving backwards without having to ask for bookmarks. AdResync With the RESYNC method, use the data update cursor in the current database. Adupdate can modify existing data using the UPDATE method. AdupdateBatch can use batch updates (UpdateBatch and CancelBatch methods) to transfer changes to the provider.

AdlockunSpecified -1 Unexpected Lock Type AdlockReadOnly 1 Read Lock Type Default

AdlockPESSIMISTIC 2 conservative record lock (strip). The provider performs the necessary operations to ensure successful editing records, usually using the record of the data source immediately when editing.

AdlockOptimistic 3 Open Record Lock (strip). The provider uses an open lock to lock the record only when the Update method is called.

AdlockBatchOptimistic 4 Batch Open Lock Type Open Batch Update. The batch update mode is used to update now.

When AdlockBatchOptimistic, AdlockOptimistic, AdlockPessimistic supports AduPdateBatch, Update, AddNew, Addelete all the same, whether the client cursor is still the server.

ADO has two basic ways for adding, deleting, and modifying data lines.

One is that the change is not immediate to the Recordset but is performed on the "copy buffer". When you do not want to change, copy the buffer.

The change will be discarded; if you want to keep your changes, the changes in the copy buffer will be applied to the Recordset.

Second, when you declare the work of the row (ie "Immediate" mode), the change will be transferred to the data source, otherwise the collection of rows will be collected.

All changes until you declare that the work of the line has been completed (ie "batch" mode). These patterns will be by CursorLocation and

LockType properties are controlled. In the "Immediate" mode, the calls of each UPDATE method are transferred to the data source, and in the "batch" mode, although each

UPDATE calls and current line position movement will be stored in RecordSet, but only UPDATEBATCH methods will change

Give the data source. Since the replardset is used to use a batch mode, the update is also used. 1. Adopenforwardonly and AdlockReadonly CursorLocation = AduseServer combination is not supported

2, AdoPendynamic and AdLockReadonly CursorLocation = AduseServer combination only supports AdmovePrevious

3, AdoPenStatic and AdlockReadonly CursorLocation = AduseServer combination does not support AduPDateBatch, Update, AdResync, AddNew, AdDelete Support AdapproxPosition, AdholdRecords, Bookmark, AdmovePrevious

4, AdoPenkeySet and AdlockReadonly CursorLocation = AduseServer combination

AduPdatebatch, Update, AddNew, AdDelete support AdapproPosition, AdholdRecords, Bookmark, AdmovePrevious, AdResync

There are three ways to return to Recordset: Connection.execute, Command.execute, and RecordSet.Open. Below

Their Visual Basic syntax:

Two methods of Connection.execute (CommandText, Recordsaffected, Options) Command.execute (Recordsaffected, Parameters, Options) do not allow the specified RECORDSET cursor type and lock options, which are defamely: AdopenForwardonly

, DLOCKREADOONLY, if the CursorLocation property is set to aduseclient, the RECORDSET's cursor is automatically changed to AdopenKeyset

Support AdHoldRecords Bookmark. If you are set to aduseserver, only 3,4 support AdHoldRecords Bookmark. So default is not supported by AdHoldRecords, and therefore, when using SET DATAGRID.DATASOURCE = Rescordset, the real-time error 7004, the collection cannot be used as a label .

So if you want to set the set dataRid.DataSource = RescordSetRecordSet.Open Source, ActiveConnection, Cursorty, LockType, Options, which can set the RecordSet cursor type and lock options when you want to set to AduseServer.

and also

Although the dynamic cursor and only the forward cursor supports (adupdatebatch) may be true, but the batch will be used for batch updates.

Markers or static cursors. Set the LockType property to AdlockBatchOptimistic, and then set the CursorLocation property.

For aduseclient to enable the engine Microsoft Client Cursor Engine required for batch update.

转载请注明原文地址:https://www.9cbs.com/read-41222.html

New Post(0)