Click here to Skip to main content
16,020,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been working on a system that runs across multiple workstations, the server creates an access database that is processed by remote systems.

I have the database/table creation working, problem comes when the creation is complete, the server keeps the database opened which means the database can't be moved to the remote system.

Below is test code that will reproduce the same issue.
VB
Dim Database As String = "C:\Database.mdb"
Do
    Try
        If File.Exists(Database) Then File.Delete(Database)
        Dim cat As New ADOX.Catalog()
        cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Database)
        cat = Nothing
    Catch ex As Exception
    End Try
    Sleep(5)  ' Code not displayed but does not put the app to sleep just a delay with application.doevents...
Loop

Checking to see if there is something I'm missing or if there is another way to create and release the database....?
Posted

1 solution

I believe you should close your connection to the DB, because it's still opened.
VB
cat.ActiveConnection.Close

Read more about Catalog here. Here is an example how one should work with connections (do not forget to close them).
 
Share this answer
 
Comments
bayotle 19-Feb-15 23:00pm    
Sweeeeeeeeeeet!
This has been driving me nuts for a LONG time, I actually put it on the back burner and worked on other sections, now I'm coming to an end with this, I had to get it worked out...

MANY thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900