strTargetTab 是定义的动态表表名
i为int型
ss[i] 是数组
代码如下
strSql  = " INSERT INTO " + strTargetTab + " \n";
strSql += " ( \n";
strSql += "     TIME_CD, \n";
strSql += "     STD_AREA_ID, \n";
strSql += "     STD_FINA_ITEM_CD, \n";
strSql += "     CONVERT, \n";
strSql += "     ETL_CYCLE_ID, \n";
strSql += "     ETL_TIME  \n";
strSql += "  ) \n";
strSql += "VALUES ('" + strCycleID + "', \n";
strSql += "        '" + strStdAreaID + "', \n";
strSql += "        '" + i + "' ,\n";
strSql += "        round(" + ss[i] + ",4), \n";
strSql += "        '" + strCycleID + "' ,   \n";
strSql += "        sysdate   \n";
strSql += "        )   \n";

解决方案 »

  1.   

    因为编译不过  
    Error 168: # Illegal types associated with operator '+': 'const char *' and 'const
                char *'.
                                                 strSql += "        '" + i + "' ,\n";
      

  2.   

    Illegal types associated with operator '+': 'const char *' and 'const char *'. c++里面可以用 ‘+’ 来连接2个字符串??? 我没学过C++只学过C ,反正C里面是不行的,我在C里面都是用sprintf的..