除了oledb.lib之外其它的Coredll.lib,ole32.lib,oleaut32.lib,Uuid.lib,都能够在D:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Lib\emulator下找到!oledbtype类型未能找到。
我开发环境是EVC4.0,SDK是PPC2003。
想不好了!
HRESULT CDlgDataBaseRepair::CompactDataBase()
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
HRESULT hr = NOERROR; // Error code reporting
DBPROPSET dbpropset[1]; // Property Set used to initialize provider
DBPROP dbprop[1]; // property array used in property set to initialize provider
// Create an instance of the OLE DB Provider for SSCE 1.0
hr = CoCreateInstance(CLSID_SQLSERVERCE_2_0, 0, CLSCTX_INPROC_SERVER, IID_IDBProperties, (void**) &pIDBProperties);
if(FAILED(hr))
{
//wcerr << L"Failed to instantiate OLE DB Provider for SSCE10" << endl;
goto Exit;
}
// Initialize Property with name of database
dbprop[0].dwPropertyID = DBPROP_INIT_DATASOURCE;
dbprop[0].dwOptions = DBPROPOPTIONS_REQUIRED;
dbprop[0].vValue.vt = VT_BSTR;
dbprop[0].vValue.bstrVal = SysAllocString(L"\\硬盘\\1.sdf");
if(NULL == dbprop[0].vValue.bstrVal)
{
hr = E_OUTOFMEMORY;
goto Exit;
}
// Set properties into the provider's DSO object
hr = pIDBProperties->SetProperties(1, dbpropset);
if(FAILED(hr))
{
//wcerr << L"Failed to set properties." << endl;
goto Exit;
}