Execute sql query in axapta


 static server ResultSet executeSqlWithResult(str _sql)  
 {  
 Connection sqlConnection;  
 Statement sqlStatement;  
 ResultSet sqlResultSet;  
 SqlStatementExecutePermission perm;  
 ;  
 sqlConnection = new Connection();  
 sqlStatement = sqlConnection.createStatement();  
 perm = new SqlStatementExecutePermission(_sql);  
 perm.assert();  
 sqlResultSet = sqlStatement.executeQuery(_sql);  
 CodeAccessPermission::revertAssert();  
 return sqlResultSet;  
 }  
 static server int executeSqlStatement(str _sql)  
 {  
 Connection sqlConnection;  
 Statement sqlStatement;  
 SqlStatementExecutePermission perm;  
 str sql;  
 int result;  
 ;  
 sqlConnection = new Connection();  
 sqlStatement = sqlConnection.createStatement();  
 perm = new SqlStatementExecutePermission(_sql);  
 perm.assert();  
 result = sqlStatement.executeUpdate(_sql);  
 CodeAccessPermission::revertAssert();  
 return result;