Execute SQL in x++

server static void main(Args _args)
{
Connection      connection;
Statement       statement;
str             query;
Resultset       resultSet;
Str1260         test = “delay”;
;

// create connection object
connection = new Connection();

// create statement
statement = connection.createStatement();

// Set the SQL statement
query = “select recid from LANGUAGETXT where LANGUAGETXT.txt = ‘” + test +”‘”;

// assert SQL statement execute permission
new SqlStatementExecutePermission(query).assert();

// when the query returns result,
// loop all results for processing
//BP Deviation documented
resultSet = statement.executeQuery(query);

while(resultSet.next())
{
// do something with the result
info(strFmt(“%1”,resultSet.getInt64(1)));
}

// limit the scope of the assert call
Cod

Leave Comment

Your email address will not be published. Required fields are marked *