public static JetOpenDatabase ( JET_SESID sesid, string database, string connect, JET_DBID &dbid, OpenDatabaseGrbit grbit ) : JET_wrn | ||
sesid | JET_SESID | The session that is opening the database. |
database | string | The database to open. |
connect | string | Reserved for future use. |
dbid | JET_DBID | Returns the dbid of the attached database. |
grbit | OpenDatabaseGrbit | Open database options. |
Résultat | JET_wrn |
public void Init(bool recoveryEnabled) { int pageSize; Esent.JetGetDatabaseFileInfo(m_filename, out pageSize, JET_DbInfo.PageSize); string dir = Path.GetDirectoryName(m_filename) + Path.DirectorySeparatorChar; Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.DatabasePageSize, pageSize, null); Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.LogFilePath, 0, dir); Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.SystemPath, 0, dir); // Put the temp DB in our working directory. Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.TempPath, 0, Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar); // Set recovery option. Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.Recovery, 0, recoveryEnabled ? "On" : "Off"); m_jetInstance = new Instance("ESEVIEW"); m_jetInstance.Init(); m_sesid = new Session(m_jetInstance); Esent.JetAttachDatabase(m_sesid, m_filename, recoveryEnabled ? AttachDatabaseGrbit.None : AttachDatabaseGrbit.ReadOnly); Esent.JetOpenDatabase(m_sesid, m_filename, null, out m_dbid, OpenDatabaseGrbit.ReadOnly); }
/// <summary> /// Opens a database previously attached with <see cref="JetAttachDatabase"/>, /// for use with a database session. This function can be called multiple times /// for the same database. /// </summary> /// <param name="sesid">The session that is opening the database.</param> /// <param name="database">The database to open.</param> /// <param name="dbid">Returns the dbid of the attached database.</param> /// <param name="grbit">Open database options.</param> /// <returns>An ESENT warning code.</returns> public static JET_wrn OpenDatabase( JET_SESID sesid, string database, out JET_DBID dbid, OpenDatabaseGrbit grbit) { return(Api.JetOpenDatabase(sesid, database, null, out dbid, grbit)); }