删除表时出问题?

shagua0916 2007-09-18 03:28:56
在我的工程中,有全局的ADO三巨头

_ConnectionPtr pMyConnect;
_RecordsetPtr m_pRecordset1,m_pRecordset2,m_pRecordset3,
_CommandPtr m_pCommand;

其中每个RecordsetPtr 管理一个表,

m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection = pMyConnect; // pMyConnect已经成功连接到数据库
CString temp1="drop table YYYY"
m_pCommand->CommandText =_bstr_t(temp1);
m_pCommand->CommandType=adCmdText;
m_pCommand->Parameters->Refresh();
m_pCommand->Execute(NULL, NULL,adCmdUnknown); //


当YYYY表非空时,执行没问题
但当YYYY无记录时,执行出现问题?为什么? 这样有问题吗?




...全文
129 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
一条晚起的虫 2007-09-30
  • 打赏
  • 举报
回复

try
{
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand- >ActiveConnection = pMyConnect; // pMyConnect已经成功连接到数据库
CString temp1="drop table YYYY"
m_pCommand- >CommandText =_bstr_t(temp1);
m_pCommand- >CommandType=adCmdText;
m_pCommand- >Parameters- >Refresh();
m_pCommand- >Execute(NULL, NULL,adCmdUnknown); //
}
catch(_com_error e)
{
CString strComError;
strComError.Format("错误编号: %08lx\n错误信息: %s\n错误源: %s\n错误描述: %s",
e.Error(), // 错误编号
e.ErrorMessage(), // 错误信息
(LPCSTR) e.Source(), // 错误源
(LPCSTR) e.Description()); // 错误描述
MessageBox(strComError,"错误");
}

//先确定是什么错误
zzh2106 2007-09-29
  • 打赏
  • 举报
回复
错误报告
leosheng 2007-09-26
  • 打赏
  • 举报
回复
连出撒错都没写出来··
  • 打赏
  • 举报
回复
报什么错...
晓风残月0110 2007-09-22
  • 打赏
  • 举报
回复
up

4,011

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧