Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > OleDbDataAdapter.Fill command locks up Access db.
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 7th July 01:08
cherian
External User
 
Posts: 1
Default OleDbDataAdapter.Fill command locks up Access db.



I am accessing an Access database through my VB.NET
application. I would like to programatically compact the
Access database. The problem that I have is for some
reason the Access database gets locked up, even after I
have closed all the recordset connections. I have narrowed
it down to the line where I am doing a "Fill" on the
OleDbDataAdapter.

My connection opening code looks as below...

-----------------------------------------------------------
--

sSQL = "SELECT * FROM ....."
sConnect = "Provider=......"
connection = New OleDbConnection(sConnect)
dataAdapter = New OleDbDataAdapter(sSQL, connection)
dsDatasources = New DataSet()
dataAdapter.Fill(dsDatasources, "Table1") 'THIS IS THE
PROBLEM LINE.
dvDatasources = New DataView(dsDatasources.Tables
("Table1"))

-----------------------------------------------------------
--

Before compacting the Access DB, I have the following line
of code to close all connections, etc...

-----------------------------------------------------------
--

dataAdapter.Dispose()
dsDatasources.Clear()
dsDatasources.Dispose()
connection.Dispose()
connection.Close()
Application.DoEvents() 'Just in case OS wants to catch up
on some tasks.

dvDatasources = Nothing
dsDatasources = Nothing
dataAdapter = Nothing
connection = Nothing

-----------------------------------------------------------
--

Even after doing all this cleanup stuff, I still get the
error of "File is being used by some other user". If I
comment out the line of "dataAdapter.Fill" then everything
goes fine.

Also, what I have noticed is that as soon as the Fill
command is executed, I have the Access lock ".ldb" file
created. I cannot delete this file, till I close my
application.

Any suggestions on what I can do to resolve this problem
would be highly appreciated.

Thanks much,
Cherian.
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666