我去oracle的论坛上看了下,类似问题的回答如下 :
Make sure that you check the 'makefile' provided by oracle to setup Visual studio 6.0 settings. For Visual studion 7.0 you may also need to update oraocci9.lib/dll.Your developer studion must have the following settings as provided in the make file::occimake
cl -GX -DWIN32COMMON -I. -I%ORACLE_HOME%\oci\include -I. -D_DLL -D_MT %1.cpp /link /LIBPATH:%ORACLE_HOME%\oci\lib\msvc oci.lib msvcrt.lib msvcprt.lib oraocci9.lib /nod:libc
goto endFollow these steps:
1. ADD the following PREPROCESSOR DIRECTIVES
A) -> WIN32COMMON
B) -> _DLL
C) -> _MT2. Add "/nodefaultlib:libcd" in 'project options' under the 'Link' tab.3. Make sure that you have the following libraries in in "Object/library modules" under the "Link" tab.4. Add "libcd" in "ignore libraries" under the "Link" tab; this may also be populated by the "/nodefaultlib:libcd" setting.
Hope it helps~想来这里问问众兄弟,有遇到这种情况吗?

解决方案 »

  1.   

    char t_str[QUERY_STRING_LENGTH];
    memset(t_str,0,QUERY_STRING_LENGTH);
    stringstream sstrem;
    sstrem<<"select * from sstable ";
    sstrem<<"where sstable.ssguid = (select ssausertable.ssguid from ssausertable ";
    sstrem<<" where ssausertable.userid = '"<<user_id<<"')";
    sstrem.read(t_str,QUERY_STRING_LENGTH); try{
    Statement *t_stmt = m_Conn->createStatement(t_str);
    ResultSet *rst = t_stmt->executeQuery();
    while (rst->next())
    {
    cout<<rst->getString(1).c_str()<<endl;
    cout<<rst->getString(2).c_str()<<endl;
    }
    }
    下面这两行 在字段字符串长度超过15 就出错
    cout<<rst->getString(1).c_str()<<endl;
    cout<<rst->getString(2).c_str()<<endl;
      

  2.   

    Thanks,The code run ok.set this env via :
    Project setting -> C/C++ -> select "Code Generation" in Category List -> Select "Multithreaded DLL" for release or select "Debug Multithreaded DLL" for debug
    -> OKand then rebuild all,it should run ok.--------------------
    以上是解决方法 ,来自
    http://forums.oracle.com/forums/thread.jspa?messageID=727997&#727997
    谢谢各位,揭贴了