⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdafx.cpp

📁 Send SMS useing Com,it is simple
💻 CPP
字号:
// stdafx.cpp : source file that includes just the standard includes
//	AdoDataGrid.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
void FGenerateError(HRESULT hr, PWSTR pwszDescription,CString decribe)
{
	CString strError;
	//strError.Format("Run-time error '%d (%x)'", hr, hr);
	//strError += "\n\n";
	strError += pwszDescription;
	strError += "\n\n";
	strError += decribe;
	AfxMessageBox(strError);
}
BOOL DoExcute(CString Query_str,CString Conn_str)
{
	_CommandPtr cmd;  //command object
	_RecordsetPtr rs;    //recordset object
	_ConnectionPtr conn; //connection object
	_variant_t vra;
	VARIANT *vt1 = NULL;
	try
	{
		//create instance of Command, Connection and Recordset.
		cmd.CreateInstance( __uuidof(Command));
		rs.CreateInstance(__uuidof(Recordset));
		conn.CreateInstance(__uuidof(Connection));
		// used for RXF_text data exchange
		
		conn->CursorLocation = adUseClient;
		//Get connection string from edit control and open connection
		conn->Open(_bstr_t( Conn_str.GetBuffer(0) ), L"", L"", -1);
		
		//Assign oppened connection object to Command object
		cmd->ActiveConnection = conn;
		
		//Get query text from edit control
		cmd->CommandText = (_bstr_t) Query_str.GetBuffer(0);
		cmd->CommandType = adCmdText;
		
		//execute the command and assign returning Recordset to previously 
		//instanciated recordset object
		try{
			rs = cmd->Execute(&vra,vt1, adCmdText);
		}
		catch(_com_error &e)
		{
			FGenerateError(e.Error(), e.Description());
			conn->Close();
			return FALSE;
		}
	}
	catch (_com_error &e)
	{
		FGenerateError(e.Error(), e.Description());
		conn->Close();
		return FALSE;
	}
	conn->Close();
	return TRUE;
}

⌨️ 快捷键说明

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