为执行Execute出现非法操作,详情请进。。。。! 可能几个str中有空的,转换成char*就成了NULL,就非法操作了!先检查一下CString中的东西! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 =》ndy_w(王麻子) 我跟踪了,肯定没有str为空的情况! 你可以捕获异常, 然后在异常中访问Connection的Errors,就样这可获取详细的错误信息,以便解决问题:详细的办法如下: catch(_com_error) { m_bResultFlag = false; m_sResultString = "创建数据集出错。"; m_sResultString += ConstructErrorString(*(m_pConnection->Errors)); }//由Errors集合出关于错误信息的字符串string ConstructErrorString(Errors &errors){ stringstream errorStringStream; ErrorPtr errorPtr; try { long nCount = m_pConnection->Errors->Count; bool bHaveADOError = false; for(long i = 0; i < nCount; i++) { errorPtr = errors.GetItem(i); errorStringStream<<"\n\tError #" <<errorPtr->Number <<"\n\t\t"<<(LPCSTR)errorPtr->Description <<"\n\t\tSource:"<<(LPCSTR)errorPtr->Source; //<<"\n\t\tSQL State:"<<(LPCSTR)errorPtr->SQLState; //<<"\nNative Error:"<<(LPCSTR)errorPtr->NativeError //产生访问异常错误 bHaveADOError = true; } if(bHaveADOError) errorStringStream<<"\n\t\t(以上错误信息由ADO ERROR报告)\n"; } catch(_com_error &e) { errorStringStream<<"\n\t"<<e.ErrorMessage(); } return errorStringStream.str();} 在应用程序中如何把协议解析成系统消息 用api创建的static 怎么修改内容? 种子填充算法的非递归算法怎么写啊 URLDownloadToFile下载下来的东西怎么小啊? 一个很菜的问题,这两个函数的作用是什么? 有windows CE嵌入式系统的开发经验的请进 谁知道 *.wdl 要用什么看~ 欢迎参加讨论:如何使MDI中的各个视图依次为选择状态? 如果VC下编的程序运行时出错就根本不知道在哪里找错,怎么办? 急聘网络开发工程师,月薪3000左右,本信息有效期只此一天! 送分:怎么反"66"变成"B"? 如何让CHTMLView不弹出各种窗口?
我跟踪了,肯定没有str为空的情况!
详细的办法如下:
catch(_com_error)
{
m_bResultFlag = false;
m_sResultString = "创建数据集出错。";
m_sResultString += ConstructErrorString(*(m_pConnection->Errors));
}//由Errors集合出关于错误信息的字符串
string ConstructErrorString(Errors &errors)
{
stringstream errorStringStream;
ErrorPtr errorPtr;
try
{
long nCount = m_pConnection->Errors->Count;
bool bHaveADOError = false;
for(long i = 0; i < nCount; i++)
{
errorPtr = errors.GetItem(i);
errorStringStream<<"\n\tError #"
<<errorPtr->Number
<<"\n\t\t"<<(LPCSTR)errorPtr->Description
<<"\n\t\tSource:"<<(LPCSTR)errorPtr->Source;
//<<"\n\t\tSQL State:"<<(LPCSTR)errorPtr->SQLState;
//<<"\nNative Error:"<<(LPCSTR)errorPtr->NativeError //产生访问异常错误
bHaveADOError = true;
}
if(bHaveADOError)
errorStringStream<<"\n\t\t(以上错误信息由ADO ERROR报告)\n";
}
catch(_com_error &e)
{
errorStringStream<<"\n\t"<<e.ErrorMessage();
} return errorStringStream.str();
}