我的设计是想一次插入10条记录,如果其中有一条记录因为某种原因(主建唯一)插入失败,不会影响其他九条记录的入库。但是实际情况是一旦有一条记录错误,其他九条记录也不会入库。请问要怎么设置呢?NOTE:1。我用的是orcale 11g自己的提供的驱动.
      2。 odbc配置的时候选择了Batch Commit mode=Commit all successful statements.
3。ParamStatusArray数据执行完还是0,并没有得到每个ROW的状态,ParamsProcessed正确,为10。[code=C/C++]
#define DESC_LEN 51
#define ARRAY_SIZE 10typedef tagPartStruct {
   SQLREAL       Price;
   SQLUINTEGER   PartID;
   SQLCHAR       Desc[DESC_LEN];
   SQLINTEGER    PriceInd;
   SQLINTEGER    PartIDInd;
   SQLINTEGER    DescLenOrInd;
} PartStruct;PartStruct PartArray[ARRAY_SIZE];
SQLCHAR *      Statement = "INSERT INTO Parts (PartID, Description,
                Price) "
               "VALUES (?, ?, ?)";
SQLUSMALLINT   i, ParamStatusArray[ARRAY_SIZE];
SQLULEN ParamsProcessed;// Set the SQL_ATTR_PARAM_BIND_TYPE statement attribute to use
// column-wise binding.
SQLSetStmtAttr(hstmt, SQL_ATTR_PARAM_BIND_TYPE,SQL_PARAM_BIND_BY_COLUMN,0);// Specify the number of elements in each parameter array.
SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMSET_SIZE, ARRAY_SIZE, 0);// Specify an array in which to return the status of each set of
// parameters.
SQLSetStmtAttr(hstmt, SQL_ATTR_PARAM_STATUS_PTR, ParamStatusArray, 0);// Specify an SQLUINTEGER value in which to return the number of sets of
// parameters processed.
SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMS_PROCESSED_PTR, &ParamsProcessed, 0);// Bind the parameters in row-wise fashion.
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0,
                  &PartArray[0].PartID, 0, &PartArray[0].PartIDInd);
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, DESC_LEN - 1, 0,
                  PartArray[0].Desc, DESC_LEN, &PartArray[0].DescLenOrInd);
SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_REAL, 7, 0,
                  &PartArray[0].Price, 0, &PartArray[0].PriceInd);// Set part ID, description, and price.
for (i = 0; i < ARRAY_SIZE; i++) {
   GetNewValues(&PartArray[i].PartID, PartArray[i].Desc, &PartArray[i].Price);
   PartArray[0].PartIDInd = 0;
   PartArray[0].DescLenOrInd = SQL_NTS;
   PartArray[0].PriceInd = 0;
}// Execute the statement.
SQLExecDirect(hstmt, Statement, SQL_NTS);// Check to see which sets of parameters were processed successfully.
for (i = 0; i < ParamsProcessed; i++) {
   printf("Parameter Set  Status\n");
   printf("-------------  -------------\n");
   switch (ParamStatusArray[i]) {
      case SQL_PARAM_SUCCESS:
      case SQL_PARAM_SUCCESS_WITH_INFO:
         printf("%13d  Success\n", i);
         break;      case SQL_PARAM_ERROR:
         printf("%13d  Error\n", i);
         break;      case SQL_PARAM_UNUSED:
         printf("%13d  Not processed\n", i);
         break;      case SQL_PARAM_DIAG_UNAVAILABLE:
         printf("%13d  Unknown\n", i);
         break;   }