After an ACCESS data file is created with ADOX, the *. ldb file appears until the program is closed. How can I disable the *. ldb file? (What are the disadvantages when it comes out? I didn't think about it. I just didn't want it to appear .) Interop. ADOX. dll should be a com component. Unlike. Net, the garbage collection mechanism has not been introduced in that era.
After an ACCESS data file is created with ADOX, the *. ldb file appears until the program is closed. How can I disable the *. ldb file? (What are the disadvantages when it comes out? I didn't think about it. I just didn't want it to appear .) Interop. ADOX. dll should be a com component. Unlike. Net, the garbage collection mechanism has not been introduced in that era.
After an ACCESS data file is created with ADOX, the *. ldb file appears until the program is closed. How can I disable the *. ldb file? (What are the disadvantages when it comes out? I didn't think about it. I just didn't want it to appear .)
Interop. ADOX. dll should be a com component. Unlike. Net, the garbage collection mechanism has not been introduced in that era, and no Dispose ()...... You cannot perform Dispose () on ActiveConnection.
Set ActiveConnection = null; Catalog = null; in this way, it seems that the pointer is set to null, but the real object has not changed.
In C #, ActiveConnection does not have the Close () method ......
After searching for half a day, I first saw the solution on a Japanese website. Maybe the search method is incorrect.
Finally, the method will be located on the two statements (one of them cannot be used separately, and two statements must be used simultaneously ):
System. Runtime. InteropServices. Marshal. FinalReleaseComObject (catalog. ActiveConnection );
System. Runtime. InteropServices. Marshal. FinalReleaseComObject (catalog );
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
using ADOX; // csc ... /r:Interop.ADOX.dll ...
// ... other code ...
public bool CreateDataFile()
{
ADOX.Catalog catalog = new Catalog();
try
{
catalog.Create(ConnString);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(catalog.ActiveConnection);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(catalog);
return true ;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false ;
}
}
|