G
Grant Schenck
Hello,
I wrote a .NET application which uses an Access Database. It only does
reads from the DB, never writes to it.
I intended for the user to be able to modify the data by just running MS
Access and directly opening the table(s) and modifying the data.
My application uses a file watcher to know when the table has changed and in
response, re-queries the rows in one of the tables.
However, some of the time (but not all) my app gets an exception ("Could not
lock file") when it goes to read the table in response to seeing that the
Access MDB file changed:
System.Data.OleDb.OleDbException: Could not lock file.
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at STPSCallRouter.ServiceCallRouter.ReadAndProcessRoutePointsFromDB()
So, my question is basic. Is there a way to allow this to work?
I initially had this as my connection string:
"Provider=" + g_strDBProvider + @"; Data Source=" + m_Settings.DBPath +
"; Mode=Read"
But then tried changing the mode to "Share Deny None" but that didn't stop
the exceptions from happening some of the time.
I wrote a .NET application which uses an Access Database. It only does
reads from the DB, never writes to it.
I intended for the user to be able to modify the data by just running MS
Access and directly opening the table(s) and modifying the data.
My application uses a file watcher to know when the table has changed and in
response, re-queries the rows in one of the tables.
However, some of the time (but not all) my app gets an exception ("Could not
lock file") when it goes to read the table in response to seeing that the
Access MDB file changed:
System.Data.OleDb.OleDbException: Could not lock file.
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
constr, OleDbConnection connection)
at
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at STPSCallRouter.ServiceCallRouter.ReadAndProcessRoutePointsFromDB()
So, my question is basic. Is there a way to allow this to work?
I initially had this as my connection string:
"Provider=" + g_strDBProvider + @"; Data Source=" + m_Settings.DBPath +
"; Mode=Read"
But then tried changing the mode to "Share Deny None" but that didn't stop
the exceptions from happening some of the time.