📄 ado1set.h
字号:
// ADO1Set.h : interface of the CADO1Set class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ADO1SET_H__D52236EF_0397_11D2_B97D_00A02456674B__INCLUDED_)
#define AFX_ADO1SET_H__D52236EF_0397_11D2_B97D_00A02456674B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CFoodOrders
{
public:
CFoodOrders()
{
memset( (void*)this, 0, sizeof(*this) );
};
BEGIN_COLUMN_MAP(CFoodOrders)
END_COLUMN_MAP()
};
class CADO1Set : public CCommand<CAccessor<CFoodOrders> >
{
public:
HRESULT Open()
{
CDataSource db;
CSession session;
HRESULT hr;
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, "");
dbinit.AddProperty(DBPROP_AUTH_PERSIST_ENCRYPTED, false);
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
dbinit.AddProperty(DBPROP_AUTH_USERID, "Admin");
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, "D:\\Vc_60\\DB_Samp\\Sample.mdb");
dbinit.AddProperty(DBPROP_INIT_MODE, (long)16);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
dbinit.AddProperty(DBPROP_INIT_PROVIDERSTRING, ";COUNTRY=0;CP=1252;LANGID=0x0409");
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
hr = db.OpenWithServiceComponents("Microsoft.Jet.OLEDB.3.51", &dbinit);
if (FAILED(hr))
return hr;
hr = session.Open(db);
if (FAILED(hr))
return hr;
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE);
hr = CCommand<CAccessor<CFoodOrders> >::Open(session, "SELECT * FROM FoodOrders", &propset);
if (FAILED(hr))
return hr;
return MoveNext();
}
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ADO1SET_H__D52236EF_0397_11D2_B97D_00A02456674B__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -