예제 #1
0
        public int ExecuteNonQuery()
        {
            ExecuteNonQueryInternal(CommandBehavior.Default);

            int numRows;

            //How many rows affected.  numRows will be -1 if we aren't dealing with an Insert, Delete or Update, or if the statement did not execute successfully
            short sqlRet = DB2CLIWrapper.SQLRowCount(hwndStmt, out numRows);

            DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecDirect error.", db2Conn);

            do
            {
                sqlRet = DB2CLIWrapper.SQLMoreResults(this.hwndStmt);
                DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLMoreResults", db2Conn);
            }while(sqlRet != DB2Constants.SQL_NO_DATA_FOUND);

            CloseStatementHandle(false);

            return(numRows);
        }