|
From: The Mad Ape on 12 Jul 2008 16:08 When I use the code below to create an mdb (access database) I am unable to release it and the locking file remains persistent. For my app this is bad if the user tries to delete the mdb later on. Has anyone encountered this scenario? Is this a bug? I am using VB.Net 2005. Is there any way to get out of this jam? Currently my app will only release its hold on the mdb after the app closes. I do not understand. Please help as I am on a deadline on Monday morning and am in a HUGE pickle. Dim catNewDB As New ADOX.Catalog XMLFILE = strFi & "\merchantable" & strDate & strTime catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & XMLFILE & ".mdb;") catNewDB = Nothing There is no member of ADOX to drop, close, destruct the connection. Thanks for any help you can provide. Peace The Mad Ape
From: Steve Gerrard on 12 Jul 2008 16:36 The Mad Ape wrote: > When I use the code below to create an mdb (access database) I am > unable to release it and the locking file remains persistent. For my > app this is bad if the user tries to delete the mdb later on. > > Has anyone encountered this scenario? Is this a bug? I am using VB.Net > 2005. Is there any way to get out of this jam? Currently my app will > only release its hold on the mdb after the app closes. I do not > understand. > > Please help as I am on a deadline on Monday morning and am in a HUGE > pickle. > > Dim catNewDB As New ADOX.Catalog > XMLFILE = strFi & "\merchantable" & strDate & strTime > catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & > XMLFILE & ".mdb;") > catNewDB = Nothing > > There is no member of ADOX to drop, close, destruct the connection. > Does catNewDB.Create(...) return the new database? If so, assigning that to a variable might make closing the new database file easier.
From: Mad Ape on 12 Jul 2008 17:07 Steve Gerrard wrote: > The Mad Ape wrote: >> When I use the code below to create an mdb (access database) I am >> unable to release it and the locking file remains persistent. For my >> app this is bad if the user tries to delete the mdb later on. >> >> Has anyone encountered this scenario? Is this a bug? I am using VB.Net >> 2005. Is there any way to get out of this jam? Currently my app will >> only release its hold on the mdb after the app closes. I do not >> understand. >> >> Please help as I am on a deadline on Monday morning and am in a HUGE >> pickle. >> >> Dim catNewDB As New ADOX.Catalog >> XMLFILE = strFi & "\merchantable" & strDate & strTime >> catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & >> XMLFILE & ".mdb;") >> catNewDB = Nothing >> >> There is no member of ADOX to drop, close, destruct the connection. >> > > Does catNewDB.Create(...) return the new database? If so, assigning that to a > variable might make closing the new database file easier. > > If it does I do not know how to find it. I have further code that opens it adds new tables and data then closes it then disposes it but the .Create also creates a connection that I can not release. Just using the above code and nothing else creates a lock with no way to remove it. I am stumped. Just to let you know I even tried: System.Runtime.InteropServices.Marshal.ReleaseComObject(catNewDB) but that does not work either. Very confused and frustrated. The Mad Ape
From: Steve Gerrard on 12 Jul 2008 17:28 Mad Ape wrote: > Steve Gerrard wrote: >> The Mad Ape wrote: >>> When I use the code below to create an mdb (access database) I am >>> unable to release it and the locking file remains persistent. For my >>> app this is bad if the user tries to delete the mdb later on. >>> >>> Has anyone encountered this scenario? Is this a bug? I am using >>> VB.Net 2005. Is there any way to get out of this jam? Currently my >>> app will only release its hold on the mdb after the app closes. I >>> do not understand. >>> >>> Please help as I am on a deadline on Monday morning and am in a HUGE >>> pickle. >>> >>> Dim catNewDB As New ADOX.Catalog >>> XMLFILE = strFi & "\merchantable" & strDate & strTime >>> catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data >>> Source=" & XMLFILE & ".mdb;") >>> catNewDB = Nothing >>> >>> There is no member of ADOX to drop, close, destruct the connection. >>> >> >> Does catNewDB.Create(...) return the new database? If so, assigning >> that to a variable might make closing the new database file easier. >> >> > > If it does I do not know how to find it. > I have further code that opens it adds new tables and data then closes > it then disposes it but the .Create also creates a connection that I > can not release. > > Just using the above code and nothing else creates a lock with no way > to remove it. I am stumped. Just to let you know I even tried: > > System.Runtime.InteropServices.Marshal.ReleaseComObject(catNewDB) but > that does not work either. > > Very confused and frustrated. > > The Mad Ape catNewDB should have an ActiveConnection property. The doc says that if Create succeeds, the connection to the newly created and opened database is assigned to the catalog active connection. Using that, you should be able to close it.
From: Mad Ape on 12 Jul 2008 18:16 Steve Gerrard wrote: > Mad Ape wrote: >> Steve Gerrard wrote: >>> The Mad Ape wrote: >>>> When I use the code below to create an mdb (access database) I am >>>> unable to release it and the locking file remains persistent. For my >>>> app this is bad if the user tries to delete the mdb later on. >>>> >>>> Has anyone encountered this scenario? Is this a bug? I am using >>>> VB.Net 2005. Is there any way to get out of this jam? Currently my >>>> app will only release its hold on the mdb after the app closes. I >>>> do not understand. >>>> >>>> Please help as I am on a deadline on Monday morning and am in a HUGE >>>> pickle. >>>> >>>> Dim catNewDB As New ADOX.Catalog >>>> XMLFILE = strFi & "\merchantable" & strDate & strTime >>>> catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data >>>> Source=" & XMLFILE & ".mdb;") >>>> catNewDB = Nothing >>>> >>>> There is no member of ADOX to drop, close, destruct the connection. >>>> >>> Does catNewDB.Create(...) return the new database? If so, assigning >>> that to a variable might make closing the new database file easier. >>> >>> >> If it does I do not know how to find it. >> I have further code that opens it adds new tables and data then closes >> it then disposes it but the .Create also creates a connection that I >> can not release. >> >> Just using the above code and nothing else creates a lock with no way >> to remove it. I am stumped. Just to let you know I even tried: >> >> System.Runtime.InteropServices.Marshal.ReleaseComObject(catNewDB) but >> that does not work either. >> >> Very confused and frustrated. >> >> The Mad Ape > > catNewDB should have an ActiveConnection property. The doc says that if Create > succeeds, the connection to the newly created and opened database is assigned to > the catalog active connection. Using that, you should be able to close it. > > The only thing I see is adding the line: catNewDB.ActiveConnection = False but that throws an error on the next line of code that is a simple message box: COMException was unhandled 'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another' System.Runtime.InteropServices.COMException was unhandled ErrorCode=-2146825287 HelpLink="C:\WINDOWS\HELP\ADO270.CHM#1240641" Message="Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another." Source="ADOX.Catalog" StackTrace: at ADOX.CatalogClass.set_ActiveConnection(Object pVal) I am totally perplexed here that something so simple is so complicated. The Mad Ape
|
Next
|
Last
Pages: 1 2 Prev: working with SQL null values.... Next: Convert hrs, mins, ms to seconds |