我打电话通过从X ++直接SQL存储过程,我无法弄清楚如何从它那里得到的整数返回值。 0是不错的,-1是坏的。
// Login to SQL DB
loginProperty = new LoginProperty();
loginProperty.setServer('localhost');
loginProperty.setDatabase('SQL_DB');
odbcConnection = new OdbcConnection(loginProperty);
statement = odbcConnection.createStatement();
/*
@in_customer_id INT
,@status INT
,@dlvmode NVARCHAR(25)
,@dlvmodedesc NVARCHAR(50)
,@tracking_id NVARCHAR(50)
,@note NVARCHAR(MAX)
,@modified SMALLDATETIME = null
,@override_email NVARCHAR(200) = null
*/
sqlStatement = strfmt(' EXEC pr_send_status_email ' +
' %1,' + // CustomerId
' %2,' + // Status
' %3,' + // DlvMode
' %4,' + // DlvMode description
' %5,' + // Tracking #
' %6,' + // Note
' %7' // DateTime
, 160308
, 2
, sqlSystem.sqlLiteral("FD1")
, sqlSystem.sqlLiteral("Fed Ex overnight")
, sqlSystem.sqlLiteral("1ZABCDEF")
, sqlSystem.sqlLiteral("Note Here")
, sqlSystem.sqlLiteral(DateTimeUtil::utcNow()));
sqlStatementExecutePermission = new SqlStatementExecutePermission(sqlStatement);
sqlStatementExecutePermission.assert();
//BP deviation documented
resultSet = statement.executeQuery(sqlStatement);
//info(strfmt("%1", statement.executeUpdate(sqlStatement))); // I Tried this too
CodeAccessPermission::revertAssert();
if (resultSet.next()) // Errors here
info(strfmt("Return: %1", resultSet.getInt(1)));