|
return TRUE; else return FALSE; } //CAdoCommand CAdoCommand::CAdoCommand() { m_AdoConnection = NULL; CommandText = adCmdText; // 创建一个命令对象实例 try { HRESULT hr = m_ptrComm.CreateInstance(__uuidof(Command)); if (FAILED(hr)) { CString errormessage("创建实例失败!"); AfxMessageBox(errormessage); } } catch(_com_error & error) { CString errormessage; errormessage.Format("创建实例失败!\r\n错误信息:%s", error.ErrorMessage()); AfxMessageBox(errormessage); } } CAdoCommand::~CAdoCommand() { m_ptrComm = NULL; } void CAdoCommand::Execute() { if ((m_AdoConnection == NULL) || (m_AdoConnection->Connected == FALSE)) return; m_ptrComm->ActiveConnection = m_AdoConnection->m_ptrConn; m_ptrComm->CommandType = CommandType; m_ptrComm->CommandText = CommandText.c_str(); try { m_ptrComm->Execute(NULL,NULL,adCmdUnknown); } catch(_com_error & error) { CString errormessage; errormessage.Format("查询数据库失败!\r\n错误信息:%s", error.ErrorMessage()); AfxMessageBox(errormessage); } } CAdoCommand::operator _CommandPtr() { return m_ptrComm; } 再来看一下我的简单的界面以及客户代码吧:
上一页 [1] [2] [3] [4] [5] 下一页 [VB.NET程序]ADO 在informix的 Addnew [VB.NET程序]ADO 的测试 [VB.NET程序]ADO 揭密 1 [Web开发][ADO]如何修改ADO的线程模型 [Web开发]Delphi7下仿Ado.Net类的实现 [Web开发]通过COM使用ADO [Web开发]ADO & ADO.NET中使用存储过程的两个共用的函数 [Web开发]Binding a DataGrid to an ADO Recordset [Web开发]ADOCE for ADO Programmers [Web开发]Delphi多线程下的ADO编程
|