ADO Mode Property

Definition and Usage

The Mode property can set or return a ConnectModeEnum Value, which indicates the permission to modify data in the Connection, Record, or Stream objects. This property is read/write when the object is closed, and read-only when the object is opened.

  • Connection object - default is adModeUnknown
  • Record object - default is adModeRead
  • Stream object - default is adModeRead or adModeUnknown

Note:This property can only be set when the Connection object is closed.

Syntax

object.Mode

Instance

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Mode=adModeReadWrite
conn.Open(Server.Mappath("northwind.mdb"))
response.write(conn.Mode)
conn.Close
%> 

ConnectModeEnum

Constant Value Description
adModeUnknown 0 Default value. Permissions have not been set or cannot be determined.
adModeRead 1 Read-only Permissions.
adModeWrite 2 Write-only Permissions.
adModeReadWrite 3 Read/Write Permissions.
adModeShareDenyRead 4 Prevents others from opening connections with read permission.
adModeShareDenyWrite 8 Prevents others from opening connections with write permission.
adModeShareExclusive 12 Prevents others from opening connections.
adModeShareDenyNone 16 Allows others to open connections with any permission. Does not deny others' read or write access.
adModeRecursive 0x400000 Used with adModeShareDenyNone, adModeShareDenyWrite, or adModeShareDenyRead, sets permissions for all sub-records of the current Record.