Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 24, 2008 05:59 PM by Mikesdotnetting
Oct 23, 2008 01:59 AM|LINK
I am using 'ADOX.Catalog' namespace and the following code to create a new MS Access database.
Private Function CreateAccessDatabase() As Boolean
'This method is called to create a new Access database
Dim ADOXCatalog As New ADOX.Catalog
If Me.NewDBConnectionString.Trim.ToString.Length = 0 Then Throw New Exception("Connection string is not specified")
'Call create method to create a new database
Catch ex As Exception
If Not ADOXCatalog Is Nothing Then
ADOXCatalog = Nothing
The moment it created database, it is also leaving a .ldb file in the same directory. I don't want that .ldb file. If I tried to delete the file forcedly, it is passing an exception "The file is being used....". All the connection strings are properly closed.
Can anyone help me to remove this .ldb file.
Oct 23, 2008 05:22 AM|LINK
.ldb file is automatically created by the system to maintain integrity. Mean if you open a database (.dbm) file system auto creates ldb file to prevent changes from other user or system.
In simple words you can say if file is already open in one software or place you or someone else wont able to delete or make changes to that file durring that time.
But if you have your Visual Studio open then try to delete the file and it gives and error just close the project or VS itself then go to that folder where is file located physicaly.
then you should able to delete the file. Because if you open database file in VS but after change even you closed it VS still keep some of the portion available in memory.
So when you try to delete the file it gives and error. Just close VS and delete file from the folder it should work.
Oct 23, 2008 05:57 AM|LINK
Thanks for the reply.
During the application process I need to remove that .ldb file for some purposes. Does this one not posible?
Oct 23, 2008 06:31 AM|LINK
You need to make sure the correct permissions are set on the folder that you are creating the database in. So you need to make sure that
MODIFY permissions are granted to the user account that ASP.NET runs under. Generally, that will be the ASPNET account on Win XP Pro, or the NETWORK SERVICE account on Win 2k3. This then means that the user acount can create AND delete the ldb file.
Oct 23, 2008 09:30 PM|LINK
All-Star is right if you are trying to delete the file by using application processes then you need to provide modify or delete permisions to your application so it will able to delete the file.
and before you delete a file you can also check doese your application has modify rights on the file or not. If file is in a readonly mode then remove that restriction.
After that you will able to delete the file.
Oct 24, 2008 06:18 AM|LINK
also check doese your application has modify rights on the file or not
It's the folder that the permissions need to be applied to, not the file. The ldb file is only created temporarily. There's no point in applying permissions to that file at all.
Oct 24, 2008 02:55 PM|LINK
my bad All-Star is right you need to give modify permissions for folder
Oct 24, 2008 05:59 PM|LINK
my bad All-Star
"All Star" is the level I appear to have reached in these forums
because of the points I have been awarded, not my name or anything like that.... Call me Mike [;)]