gxp_adoquery.cpp

来自「Visual C++高级编程及其项目应用开发(含源代码)」· C++ 代码 · 共 51 行

CPP
51
字号
// Gxp_adoQuery.cpp : Implementation of CGxp_adoQuery
#include "stdafx.h"
#include "AdoQuery.h"
#include "Gxp_adoQuery.h"
#include "adoQueryDlg.h"

/////////////////////////////////////////////////////////////////////////////
// CGxp_adoQuery

STDMETHODIMP CGxp_adoQuery::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&IID_IGxp_adoQuery
	};
	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i],riid))
			return S_OK;
	}
	return S_FALSE;
}

STDMETHODIMP CGxp_adoQuery::GetQuery(IDispatch *pDisp, BSTR *pSql)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	m_recordset = (_RecordsetPtr)pDisp;
	CadoQueryDlg queryDlg(m_recordset);
	int nRet;
	_bstr_t strSql = L"";

	// 使得窗体总在最前面
	//BringWindowToTop();

	nRet = queryDlg.DoModal();
	if(nRet != -1)
	{
		strSql = queryDlg.m_QuerySql;
	}
	else
	{
		strSql = L"";
	}
	
	*pSql = strSql; 

	return S_OK;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?