ACCESS?????洢??????????????????
???????????? ???????[ 2014/12/24 13:28:56 ] ????????ACCESS?????
???????????????????ACCESS?????洢?????ΧAIS?豸??????????????????????????в????????????????????????洢????????????????ν???2000???μ??λ???????Щ??????????????????С??????1M??2M???????????????????С???????????????40M????960M??
???????????????Ч????????????д洢???????????ж???????????30?????????????ACCESS?????delete?????????????????????????????е?????????????????????????????С?????
??????????????????????????????д????????????????????????????????????delete????????
??????????????£?
============================================
BOOL CPetrelProView::CompactDatabase()
{
WriteLog("===???????????==="??"COMPDB");
//::CoInitialize(NULL);
CString sDBFilePathName = GetModulePath() + "ShipSurvey.mdb";//????????
CString sDstDBFilePathName = GetModulePath() + "ShipSurvey_back.mdb";//??????
try
{
::DeleteFile(sDstDBFilePathName);//??????е???????
CFile::Rename(sDBFilePathName??sDstDBFilePathName);//?????????????????????
}
catch(...)
{
WriteLog("???????????"??"COMPDB");
return FALSE;
}
IJetEnginePtr jet(__uuidof(JetEngine));
BOOL bOK = TRUE;
try
{
//????????????????
CString sSrc;
sSrc.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Jet OLEDB:Database Password="??sDstDBFilePathName);
CString sDst;
sDst.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password="??sDBFilePathName);
long lResult = jet->CompactDatabase(_bstr_t(sSrc)??_bstr_t(sDst));
jet.Release();
//::CoUninitialize();
if(lResult == S_OK)
{
WriteLog("??????????ɡ?"??"COMPDB");
WIN32_FILE_ATTRIBUTE_DATA fad;
GetFileAttributesEx(sDBFilePathName??GetFileExInfoStandard??&fad);
CString sDBSize;
sDBSize.Format("???????????С??%.1fM"??fad.nFileSizeLow/1048576.0);
WriteLog(sDBSize??"COMPDB");
}
else
{
WriteLog("????????????"??"COMPDB");
CFile::Rename(sDstDBFilePathName??sDBFilePathName);//?????????????????????
bOK = FALSE;
}
}
catch(_com_error &e)
{
//::CoUninitialize();
WriteLog((LPCTSTR)e.Description()??"COMPDB");
WriteLog("????????????"??"COMPDB");
CFile::Rename(sDstDBFilePathName??sDBFilePathName);//?????????????????????
bOK = FALSE;
}
catch(...)
{
WriteLog("????????????"??"COMPDB");
CFile::Rename(sDstDBFilePathName??sDBFilePathName);//?????????????????????
bOK = FALSE;
}
WriteLog("===???????????==="??"COMPDB");
return bOK;
}
========================================================
|
??????????????????????????????????????????????????????????????????????????????????????????????????????????500M?????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????Щ???????????????????????VC?????????Щ????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11