代码如下: _CommandPtr m_pCommand;
try{
m_pCommand.CreateInstance("ADODB.Command");
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
try{
m_pCommand->ActiveConnection=m_pConnection;
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
CString strSQl;
strSQl ="create or replace directory PATH as ";
strSQl+="\'"+m_nDirectory+"\';";
//m_nDirectory是用File对话框获得的文件路径
MessageBox(strSQl);
m_pCommand->CommandText=_bstr_t(strSQl);
try{
m_pCommand->Execute(NULL,NULL,adCmdText);
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
每次执行到m_pCommand->Execute(NULL,NULL,adCmdText)这一句时就出错,
最后的MessageBox显示的错误是IDispatch error #3092,怎么办呢?
try{
m_pCommand.CreateInstance("ADODB.Command");
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
try{
m_pCommand->ActiveConnection=m_pConnection;
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
CString strSQl;
strSQl ="create or replace directory PATH as ";
strSQl+="\'"+m_nDirectory+"\';";
//m_nDirectory是用File对话框获得的文件路径
MessageBox(strSQl);
m_pCommand->CommandText=_bstr_t(strSQl);
try{
m_pCommand->Execute(NULL,NULL,adCmdText);
}
catch(_com_error &e){
MessageBox(e.ErrorMessage());
return;
}
每次执行到m_pCommand->Execute(NULL,NULL,adCmdText)这一句时就出错,
最后的MessageBox显示的错误是IDispatch error #3092,怎么办呢?
{
AfxMessageBox(e.Description());
return;
}
时出错,现在我在别人的机子上用,前面都没问题了,可是到了后面的Execute出错。
郁闷啊!怎么总是有问题呢?
strSQl+="\'"+m_nDirectory+"\'";
我倒是也知道分号只是sql/plus中的结束符,可我以前都是加分号的,没问题啊,而且我这个程序中insert语句中也加了分号,也能执行,真是
下次所有语句都不加分号了 :(