By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Database creation problems

P: n/a
I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat =
nothing. As soon as I stop my program, it frees it up and deletes the .ldb
file.

What do I have to do to close the database so I can delete it?

-Jerry
Nov 6 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till the
application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat
= nothing. As soon as I stop my program, it frees it up and deletes the
.ldb file.

What do I have to do to close the database so I can delete it?

-Jerry

Nov 6 '06 #2

P: n/a
It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till the
application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set cat
= nothing. As soon as I stop my program, it frees it up and deletes the
.ldb file.

What do I have to do to close the database so I can delete it?

-Jerry


Nov 7 '06 #3

P: n/a
I've cracked it

Dim cat As Catalog = New Catalog()
Dim CurDB As String
CurDB = DestPath & "MyDatabase.mbd"

cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & CurDB)
cat.ActiveConnection.Close()
cat.ActiveConnection = Nothing
cat = Nothing
-Jerry


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:YP******************************@comcast.com. ..
It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>>I have the same issue.

I have a procedure that creates an adox table and creates some fields and
indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till
the application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>>>I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation. It
also creates MyDatabase.ldb and this doesn't go even after I have set
cat = nothing. As soon as I stop my program, it frees it up and deletes
the .ldb file.

What do I have to do to close the database so I can delete it?

-Jerry



Nov 10 '06 #4

P: n/a
So it seems to be the cat.activeconnection = nothing

Thanks!

M.

"Jerry Spence1" <je**********@somewhere.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
I've cracked it

Dim cat As Catalog = New Catalog()
Dim CurDB As String
CurDB = DestPath & "MyDatabase.mbd"

cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=" & CurDB)
cat.ActiveConnection.Close()
cat.ActiveConnection = Nothing
cat = Nothing
-Jerry


"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:YP******************************@comcast.com. ..
>It probably has to do with garbage collection.
You may close all of your connections to the file,
but until the garbage collector releases all of them,
the file will still be locked. That's my guess.

Robin S.

"Miro" <mi******@golden.netwrote in message
news:uw**************@TK2MSFTNGP02.phx.gbl...
>>>I have the same issue.

I have a procedure that creates an adox table and creates some fields
and indexes and then fully closes.

However Even if i go into windows explorer I cannot move the file till
the application is done.
I couldnt figure out what it was, so now i create the file in the proper
spot, and on next load, if it was a temp file i check
for these temp files and delete it out then.

Prior to exiting out hte first time i make sure the data file is empty.

Miro

"Jerry Spence1" <1@2.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
I am creating a database as so:
Dim cat As New ADOX.Catalog()
Dim CurDB as String
Dim sCreateString As String

CurDB = "MyDatabase.mdb"
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurDB
cat.Create(sCreateString)
cat = Nothing

The problem is that I wish to delete this database after copying it to
another folder. I can't because it says there is a sharing violation.
It also creates MyDatabase.ldb and this doesn't go even after I have
set cat = nothing. As soon as I stop my program, it frees it up and
deletes the .ldb file.

What do I have to do to close the database so I can delete it?

-Jerry



Nov 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.