ADOCE Control Reference

Team-Fly    

 
eMbedded Visual Basic: Windows CE and Pocket PC Mobile Applications
By Chris Tacke, Timothy Bassett
Table of Contents
appendix A.  Control Reference


The ADOCE control is used to create and manipulate data residing in Pocket Access or SQL Server CE databases. The control is added to an eVB project via the Project/References dialog. Depending on version, it will display as "Microsoft CE ADO Control x.x", where "x.x" is the version number. The latest available version at the time of publication is 3.1. The file for the ADOCE control is adocedt30.dll or adocedt31.dll, depending on version.

Table A.17. ADOCE.Connection Properties
Property Type Description
Attributes Long Implemented only with OLEDBCE providers.
ConnectionString String Information on where and how the connection object should open the data source. With Pocket Access, merely provide the Pocket Access file path and name . For example, ConnectionString = "\Program Files\My Application\MyPocketAccess.cdb". Note: Make sure to localize the "Program Files" directory according to the application's needs.
Errors Collection Collection of all ADOCE.Errors on Connection object since Connection was opened or Connection.Errors.Clear was called. See ADOCE.Error.
Properties Collection Provides collection of properties about the Connection. See provider documentation as to properties available. Not implemented with Pocket Access.
Provider String Name of the provider for the data. Pocket Access is "CEDB".
State ADOCE.ObjectStateEnum Provides the open or closed state of the Connection object.
Version String Version number of ADOCE server DLL(s).
Table A.18. ADOCE.Connection Methods
Method Parameters Description
BeginTrans None Begins a database transaction that supports an atomic unit of work. Not implemented with Pocket Access.
Close None Closes the current connection.
CommitTrans None Commits changes to data since last BeginTrans. Not implemented with Pocket Access.
Execute

CommandText; String

[RecordsAffected]; Long (ByRef) Number of records affected by data manipulation statement (Not implemented with Pocket Access)

[Options]; Long Not implemented with Pocket Access.

Executes a SQL Statement statement and returns the resulting recordset.
Open

[ConnectionString]; String ConnectionString to access the data store. If left blank in ADOCE, the connection will open the Windows CE Object Store.

[UserId]; String User ID for access to data store. Not implemented in Windows CE Object Store or Pocket Access.

Password for user ID for [Password]; String provided access to data store. Not implemented in Windows CE Object Storeor Pocket Access.

Opens a data source for access to data.
RollbackTrans None Discards changes made to data since BeginTrans was invoked. Not implemented in Windows CE Object Store or Pocket Access.
Table A.19. ADOCE.Field Properties
Property Type Description
ActualSize Integer Length of the field in the data store. This can be confusing for string types, because Windows CE strings are always UNICODE; therefore, the ActualSize of the field will be twice the character length.
Attributes Long Bit-shifted value for information about the field. It contains information such as whether the field may be updated in its current state, whether it allows NULLs, and whether it is a primary key. Refer to ADOCE documentation for these values.
DefinedSize Integer Length of the field as defined when it was created. This yields the capacity of the field in length.
Name String Name of the field.
NumericScale (Float). Byte Number of digits to the left of the decimal
Precision Integer Number of total digits available in the field.
Type ADOCE.DataTypeEnum Value that relates to a member of the DataTypeEnum. The actual type of the field. For example, adDate, adInt, adVarChar.
UnderlyingValue Variant The value of the field before it was changed (if changed). Can be useful for auditing and dirty record detection.
Table A.20. ADOCE.Field Methods
Method Parameters Description
AppendChunk Data ; Variant Information to be appended to the field. Appends data to a binary or text field. Implemented only with an OLEDBCE provide. Version 3.1 and higher.
GetChunk Size ; Long Number of bytes to be returned. Returns data from a binary or text field. Implemented only with an OLEDBCE provider. Version 3.1 and higher.
Table A.21. ADOCE.Recordset Properties
Property Type Description
AbsolutePage Long; Read/Write Position of the record within the data pages.
AbsolutePosition Long; Read/Write The position of the current record within the recordset.
ActiveConnection Object; ADOCE.Connection

Returns a reference to the connection used to open the recordset. If queried directly, will return the connection.

ConnectionString, as ConnectionString is the default property for the ADOCE.Connection object.

BOF Boolean; Read-only Returns True if the AbsolutePosition is before the first record in the recordset.
Bookmark Variant; Read/Write If queried, returns a unique variant that if set onto the recordset will return the recordset to the same record. If set, locates the AbsolutePosition to the record where the value of Bookmark was queried from.
CursorType Long; ADOCE. CursorTypeEnum For Windows CE Object Store or Pocket Access, only adOpenForwardOnly and adOpenKeyset are implemented.
EditMode Long; ADOCE. EditModeEnum Read-Only Specifies the current state of the current record. See ADOCE.EditModeEnum.
EOF Boolean; Read-Only Returns True if the AbsolutePosition has been placed past the last record in the recordset.
Fields Collection; ADOCE.Fields Collection of all fields in the record. See ADOCE.Fields.
Filter Variant Returns or sets the current filtering. Only supports bookmarks and adFilterNone. Not implemented in Windows CE Object Store or Pocket Access.
Index StringLong Sets or returns the currently set index of the recordset. Can only be used with base table recordset (adCmdTableDirect). Can be the name of the index or the number of the index (as created). Not implemented in Windows CE Object Store or Pocket Access.
LockType Long; ADOCE.LockTypeEnum
PageCount Long; Read-Only Number of data pages in the recordset.
PageSize Long; Read/Write Number of records to a page.
Properties Collection; ADOCE.Properties Not implemented in Windows CE Object Store or Pocket Access.
RecordCount Long Number of records in recordset. Can return adUnknown.
Source String; Read-only after the recordset is opened. Write before the recordset is open The SQL string that creates the recordset or created the recordset. Set the source before Open is called. Or, can be read after therecordset is . opened.
State Long; ADOCE.ObjectStateEnum Read-Only Returns the open or closed state of the recordset.
Table A.22. ADOCE.Recordset Methods
Property Parameters Description
AddNew [ Fields ];Array of field to set values for. [ Values ]; Array of the values corresponding to Fields array. Appends a new record to the recordset. Sets values of fields if arrays provided as parameters.
CancelUpdate None Discards any changes made to the current record.
Clone [ LockType ]; ADOCE.LockType Returns a copy of the recordset.
Close None Closes the recordset.
Delete [ AffectRecords ]only accepts adAffectCurrent, a value of 1. Deletes the current record.
Find

Criteria ; StringString containing the field to search upon, the comparison operator and the value. ( object. Find("LastName = 'Smith'"

[ SkipRows ]; Longoffset to start searching from current record.

[ searchDirection ]; ADOCE. SearchDirectionEnum direction to search, forward, or backward.

[start] ; Variant Bookmark to begin searching from.

Locates the first record matching the criteria provided.
GetRows

[Rows] ; LongNumber of rows to return.

[ Start ]; LongVariantRecord number of Bookmark of where to start returning rows.

[ Fields ]; ArrayFields to return values for.

Returns an array of the values from the recordset.
Move

NumRecords ; LongNumber of records to offset to.

[Start] ; LongVariant Record number of Bookmark of where to start returning rows.

Move a specified offset from the current record.
MoveFirst None Moves to the first record of the recordset.
MoveLast None Moves to the last record of the recordset.
MoveNext None Moves to the next record of the recordset.
MovePrevious None Moves to the previous record of the recordset.
Open

Source ; StringTable name or SQL Statement.

[ ActiveConnection ]; ADOCE. ConnectionConnection to use.

[ CursorType ]; ADOCE.CursorTypeCursor type for the recordset.

[ LockType ]; ADOCE.LockTypeLock type for the recordset

[ Options ]; LongSee provider documentation. AdCmdTableDirect is used with SQL Server CE to provide and updateable recordset.

Opens a new recordset.
Requery None Refreshes the recordset.
Supports CursorOptions ; ADOCE. CursorOptionEnum Returns Boolean as to whether the recordset supports the requested cursor option. e.g. object. Supports (adAddNew).
Update

[ Fields ];Array of field to set values for.

[ Values ]; Array of the values corresponding to Fields array.

Commits changes to record back to data store.
Table A.23. ADOCE.Error Properties
Property Type Description
Description String; Read-Only Friendly description of error that occurred.
ErrorParameters Collection; String Collection of errors from last execution attempt. Not implemented in Windows CE Object Store or Pocket Access.
HelpContext Long Not implemented in Windows CE at all.
HelpFile String; Read-Only File path to the help file for the error.
NativeError Long; Read-Only Native error returned from the data provider. Limited functionality with Windows CE Object Store or Pocket Access.
Number Long; Read-Only Error number as implemented in OLE.
Source String Name of the object that generated the error. Very limited implementation for Windows CE Object Store or Pocket Access.

Team-Fly    
Top
 


eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2001
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net