DALMyBools.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:2k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- // DALMyBools.h : Declaration of the CDALMyBools
- #ifndef __DALMYBOOLS_H_
- #define __DALMYBOOLS_H_
- #include "resource.h" // main symbols
- #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adEOF")
- /////////////////////////////////////////////////////////////////////////////
- // CDALMyBools
- class ATL_NO_VTABLE CDALMyBools :
- public CComObjectRootEx<CComSingleThreadModel>,
- public CComCoClass<CDALMyBools, &CLSID_DALMyBools>,
- public ISupportErrorInfo,
- public IDispatchImpl<IDALMyBools, &IID_IDALMyBools, &LIBID_BOOKSDALLib>
- {
- public:
- CDALMyBools()
- {
- this->m_sqlQueryById="select * from ocybooks where bookisnb=?";
- this->m_sqlQueryAll="select * from ocybooks";
- this->m_sqlUpdate="update ocybooks set bookname=?,bookauthor=? where bookisnb=?";
- this->m_sqlSave="insert into ocybooks (bookisnb,bookname,bookauthor) values(?,?,?)";
- this->m_sqlDelete="delete from ocybooks where bookisnb=?";
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_DALMYBOOLS)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CDALMyBools)
- COM_INTERFACE_ENTRY(IDALMyBools)
- COM_INTERFACE_ENTRY(IDispatch)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
- END_COM_MAP()
- // ISupportsErrorInfo
- STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
- // IDALMyBools
- public:
- //属性;Datasource, pwd,uid;
- STDMETHOD(get_DataSource)(/*[out, retval]*/ BSTR *pVal);
- STDMETHOD(put_DataSource)(/*[in]*/ BSTR newVal);
- STDMETHOD(get_PWD)(/*[out, retval]*/ BSTR *pVal);
- STDMETHOD(put_PWD)(/*[in]*/ BSTR newVal);
- STDMETHOD(get_UID)(/*[out, retval]*/ BSTR *pVal);
- STDMETHOD(put_UID)(/*[in]*/ BSTR newVal);
- //表的insert/delete/update/select
- STDMETHOD(Update)(/*[in]*/ DTOBook* Book, /*[out]*/ UINT* iResult);
- STDMETHOD(DeleteBookById)(/*[in]*/ UINT id, /*[out]*/ UINT* iResult);
- STDMETHOD(SaveBook)(/*[in]*/ DTOBook* bookdata, /*[out]*/ UINT* pResult);
- STDMETHOD(QueryAllBook)(/*[out]*/ DTOBook** allBook);
- STDMETHOD(GetBookByIsbn)(/*[in]*/ UINT bookisbn,/*[out]*/ DTOBook** mybook);
- private:
- //连接方法
- _ConnectionPtr GetMyConn();
- //参数定义方法;
- _ParameterPtr GetIdPara(UINT id,_CommandPtr sqlObj);
- _ParameterPtr GetNamePara(CString name,_CommandPtr sqlObj);
- _ParameterPtr GetAuthorPara(CString author,_CommandPtr sqlObj);
- CString m_sqlQueryById;
- CString m_sqlQueryAll;
- CString m_sqlUpdate;
- CString m_sqlSave;
- CString m_sqlDelete;
- CString m_UID;
- CString m_PWD;
- CString m_DataSource;
- };
- #endif //__DALMYBOOLS_H_