class Cgroup : public CCommand<CAccessor<CgroupAccessor> >
{
public:
HRESULT Open()
{
HRESULT hr; hr = OpenDataSource();
if (FAILED(hr))
return hr; return OpenRowset();
}
HRESULT OpenDataSource()
{
HRESULT hr;
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT); dbinit.AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true);
dbinit.AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false);
dbinit.AddProperty(DBPROP_AUTH_MASK_PASSWORD, false);
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR(""));
dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("admin"));
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, OLESTR("G:\\db\\kq.mdb"));
dbinit.AddProperty(DBPROP_INIT_MODE, (long)16);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
dbinit.AddProperty(DBPROP_INIT_PROVIDERSTRING, OLESTR(";COUNTRY=0;CP=1252;LANGID=0x0409"));
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
hr = db.Open(_T("Microsoft.Jet.OLEDB.4.0"), &dbinit);
if (FAILED(hr))
return hr; return m_session.Open(db);
}
HRESULT OpenRowset()
{
CDBPropSet propset (DBPROPSET_ROWSET);
propset.AddProperty (DBPROP_IRowsetChange, true);
propset.AddProperty (DBPROP_UPDATABILITY,DBPROPVAL_UP_DELETE);
return CCommand<CAccessor<CgroupAccessor> >::Open(m_session,NULL,&propset);
}
CSession m_session;
};