Designer locking mdb file... (file and dir GRANTS FULL CONTROL FOR "EVERYONE")

  • Thread starter Thread starter Praveen
  • Start date Start date
P

Praveen

Here is an easy issue to reproduce:

1) Create a new project.
2) Drop a DataGrid control into the Page. Also drop a OleDbDataAdapter into
the page.
3) Select "Configure Data Adapter..." and pick the NWind.mdb (for example).
Go ahead and run through the wizard, selecting a table via sql query. Note
that at the end of this a Nwind.ldb lock has been created in that dir.
4) Generate the Dataset and set the datagrid's datasource property to point
to that dataset.
5) Run the page and notice that it cannot open the above mdb because of the
above lock.

Like I mentioned the nwind.mdb and it's dir both grant FULL CONTROL to the
"Everyone" account, so that's not the issue.

In fact, if you close VS and reopen, the above lock will be released and the
page could be run without any problem.

So, the quesiton is why does the Data Adapter Wizard create a lock and NOT
release it when it's done?

Surely, having to reopen VS.Net after setting up a connection to an mdb file
is not very elegant. Has this been recognized as a bug? If so, are there
workarounds? I am implementing a custom control and don't mind applying some
workarounds there.

Thanks in advance.
-Praveen
 
Hi Praveen,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have configured an
OleDbDataAdapter, it still connects the the .mdb file. If there is any
misunderstanding, please feel free to let me know.

As far as I know, this is by design. Because when we configured the
OleDbDataAdapter, we also added a new OleDbConnection object. When the
OleDbConnection object is added, a new Data Connection will be added to
Server Explorer. We will see the connection there.

To workaround this issue, we have to open the Server Explorer. Right click
on the connection and select Close Connection.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top