Call Direct SQL in X++
static void TestDirectSQLInXpp(Args _args)
{
str sqltxt = "select * from custtable where custtable.accountnum == '4001'";
source sqlcmd;
XppCompiler compiler = new XppCompiler();
custtable ct;
ExecutePermission executePermission;
common com;
;
if (sqltxt)
{
sqlcmd = 'CustTable SQLSTMT(CustTable CustTable' +')\n{\n'+sqltxt+';\nreturn CustTable;\n}\n';
if (compiler.compile(sqlcmd))
{
executePermission = new ExecutePermission();
executePermission.assert();
com = runbuf(sqlcmd,ct);
ct = com;
print ct.AccountNum;
}
else
{
setprefix("@SYS57538");
info (sqlcmd);
error (compiler.errorText());
}
}
else
{
sqlcmd = '';
}
pause;
}
posted on 2008-07-15 10:59 lingdanglfw 阅读(264) 评论(1) 编辑 收藏 举报