OLEDBCommand - locking error selecting data from dBase III

  • Thread starter Thread starter Chris Anderson
  • Start date Start date
C

Chris Anderson

Getting the following error when attempting to read in a dBase III file
through ADO.net:

Could not lock table 'Table#dbf'; currently in use by user '(unknown)' on
machine '(unknown)'.,Microsoft JET Database Engine, at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at MyApp.frmMain.btnImport_Click(Object sender, EventArgs
e),ExecuteCommandTextErrorHandling,

The app works fine on 'my machine', but this error happens consistently on
my client machines running the 1.1 framework


I'm using Visual Studio.net 2002 with both the 1.0 and 1.1 framework
installed.

My first pass involved using an OLEDBAdapter to fill a data table, thats
where the error occurred. I rewrote the whole routine to use a DataReader,
thinking it had something to do with the DataAdapter's concurrency stuff and
using the read-only cursor was the answer: No luck, the same exception
occurs.

'create a table of all of the data
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM " & fileName,
cnSource)
cmd.CommandType = CommandType.Text

Any ideas??
 
Stumbled upon a workaround...

If the file is first copied to another directory, this exception does not
occur... Suspect it has something to do with .net being the owner, or the
account that .net runs under being the owner...
 
Back
Top