以前写了个程序,运行一直正常.后来换了用户名,密码就出问题了.
老是报错 ora-00903错误 表名无效程序是用vc,如下
m_pRecordset->Open("Select * from IDEN.TBL_TEST",_variant_t((IDispatch *)m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdTable);都写成这样了,还是有问题,郁闷一整天了.有没有高手解决一下,谢谢!

解决方案 »

  1.   

    换了用户密码?
    那末现在登陆的用户对:Select * from IDEN.TBL_TEST
    中的IDEN schema又没有操作权限呢?
    建议最好用IDEN登陆。应该是用户权限的问题。
      

  2.   

    用同一个用户名,密码在toad里运行
    Select * from IDEN.TBL_TEST
    没有问题啊,我真是晕死了.
      

  3.   

    如果是这样。不妨可以如此猜测:程序中是否有什么不妥当的地方。执行一下select user from dual(vc中,错误语句前),看看是什么。然后再做论断。
      

  4.   

    我把相关的代码贴出来吧,我真的找不出问题了..文件DBOpr.cpp中的
    bool DBOpr::boolDBSearch(CString strName,ADOconn* da)
    {
    int icc=0;
    while(icc<2)
    {
    try
    {
    if(da==NULL)
    {
    da=new ADOconn();
    da->OnInitADOConn();
    icc++;
    continue;
    }
    _variant_t vTemp;
    CString strTemp="";
    CString strTemp1="";
    _bstr_t strSQL="";
    strTemp1="select * from TBL_IDEN_FILE_COPY";
    strSQL=(_bstr_t)strTemp1;
    da->m_pRecordset=da->GetRecordSet(strSQL);
    while(!(da->m_pRecordset->ADOEOF))
    {
    vTemp=da->m_pRecordset->GetCollect("NAME");
    strTemp=(CString)vTemp;
    if(strTemp.Compare(strName)==0)
    return true;
    da->m_pRecordset->MoveNext();
    }
    icc++;
    }
    catch(char* e)
    {
    ::AfxMessageBox(e);
    icc++;
    }
    }
    return false;
    }文件ADOconn.cpp中的
    void ADOconn::OnInitADOConn(void)
    {
    ::CoInitialize(NULL); m_pConnection=NULL;
    HRESULT hr=m_pConnection.CreateInstance(_uuidof(Connection));
    if(FAILED(hr)) 
    return;
    try
    {
    _bstr_t m_strCnt="Provider=MSDAORA.1;Data Source=ORCL_192.168.10.102;User ID=test;Password=test";
    m_pConnection->Open(m_strCnt,"","",adModeUnknown);
    }
    catch(_com_error &e)
    {
    CString err;
    err.Format("%s",(char*)(e.Description()));
    AfxMessageBox(err);
    }
    }_RecordsetPtr& ADOconn::GetRecordSet(_bstr_t bstrSQL)
    {
    //TODO: return statement
    try
    {
    if(m_pConnection==NULL)
    OnInitADOConn();
    m_pRecordset.CreateInstance(_uuidof(Recordset));
    m_pRecordset->Open("Select * from IDEN.TBL_IDEN_PATS_TEST",_variant_t((IDispatch *)m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdTable);
    //m_pRecordset->Open(bstrSQL,_variant_t((IDispatch *)m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdTable);
    }
    catch(_com_error &e)
    {
    CString err;
    err.Format("%s",(char*)(e.Description()));
    AfxMessageBox(err);
    }
    return m_pRecordset;
    }请帮忙看一下,谢谢!