Last modified: January 09, 2012
Applies to: Windows | Windows Server
The JetOpenTable function opens a cursor on a previously created table.
JET_ERR JET_API JetOpenTable( __in JET_SESID sesid, __in JET_DBID dbid, __in const tchar* szTableName, __in_opt const void* pvParameters, __in unsigned long cbParameters, __in JET_GRBIT grbit, __out JET_TABLEID* ptableid );
The database session context to use.
The database identifier to use to find the table.
The name of the table to open.
Deprecated. Set to NULL.
Deprecated. Set to 0 (zero).
A group of bits specifying zero or more of the following options.
The table cannot be opened for read-access by another database session.
The table cannot be opened for write-access by another database session.
Do not cache the pages for this table.
Allows DDL modification on tables flagged as FixedDDL. This option must be used with the JET_bitTableDenyRead option.
Provides a hint that the table is probably not in the buffer cache, and that pre-reading may be beneficial to performance.
Requests read-only access to the table.
The table should be very aggressively prefetched from disk because the application will be scanning it sequentially.
Requests write-access to the table.
On success, points to the identifier of the table. On failure, the contents for ptableid are undefined.
This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.
The operation completed successfully.
dbid is not a valid database identifier.
A bad combination of grbit was passed in.
The name given in szTableName is invalid.
For more information about valid table names, see the szTableName parameter in JetCreateTable.
An attempt was made to open a table that does not exist in the database.
The operation failed because the engine cannot allocate the resources required to open a new cursor. See the Remarks section.
The table is being used by another database operation.
A nonfatal warning indicating that the table is being used by the system.
The table is locked by another database operation.
An attempt was made to open too many unique tables at once. See the Remarks section.
Tables opened with JetOpenTable should usually be closed with JetCloseTable. The exception to this rule happens when JetOpenTable is called in a transaction and the transaction is rolled back (with JetRollback). When rolling back a transaction, the table is automatically closed. In this case, it is an error to close the table with JetCloseTable.
It is legal to open system tables with JetOpenTable (for example, MSysObjects, MSysUnicodeFixup). The schema of the system tables may change, so accessing system tables is discouraged. The number of unique tables that can be opened simultaneously is affected directly by JET_paramMaxOpenTables. If the table is currently open then a new cursor will be created on the table. Cursor resources are configured using JetSetSystemParameter with JET_paramMaxCursors. Also see JetDupCursor.
Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Declared in Esent.h.
Implemented as JetOpenTableW (Unicode) and JetOpenTableA (ANSI).