Asp.net (C #) Online compression and repair of access databases

Source: Internet
Author: User

Add reference COM: C: \ winnt \ system32 \ msjro. dll
Operation:
Tlbimp c: \ winnt \ system32 \ msjro. dll
/Out: e: \ jeky \ netpage \ www.icar365.cn \ bin \ mymsjro. dll
/Namespace: myjro
The Assembly file generated by tlbimp.exe must be placed in the \ bin directory of the ASP. NET application.
After the operation is executed, two files are generated, one is mymsjro. dll, and the other is deleted from the bin directory.

Call:
Using myjro; // namespace
Void compressaccess (){
String strconn1 = "provider = Microsoft. Jet. oledb.4.0; Data Source =" + server. mappath ("/bin/IP. mdb ");
String strconn2 = "provider = Microsoft. Jet. oledb.4.0; Data Source =" + server. mappath ("/bin/ip2.mdb ");
Jetengine databaseengin = new jetengine ();
Databaseengin. compactdatabase (strconn1, strconn2 );
}

Well, the core program has been completed, and the next step is simple: ip2.mdb is the compressed database, copy it to IP. mdb, and then delete ip2.mdb.
Note: You must delete ip2.mdb. Otherwise, an error will occur when you perform this operation next time. The error message is displayed: ip2.mdb already exists.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.