Axapta : Execute SQL command

Axapta มีคำสั่ง SQL รวมอยู่ใน X++ อยู่แล้ว
แต่ถ้าอยากใช้คำสั่ง SQL อื่น ๆ เช่น ใช้ประโยชน์จาก NewID() ของ MS SQL Server เพื่อ random ก็ทำได้ ดังตัวอย่าง
static void Job3(Args _args)
{
LogInProperty Lp = new LogInProperty();
OdbcConnection myConnection;
Statement myStatement;
ResultSet myResult;
str sqlQuery;
;

sqlQuery = 'SELECT TOP 10 * FROM CustTable ORDER BY NewID()';

LP.setServer("Server");
LP.setDatabase("db");
Lp.setUsername("user");
Lp.setPassword("password");

try{
myConnection = new OdbcConnection(LP);
}
catch{
info("Check username/password.");
return;
}

myStatement = myConnection.createStatement();
myResult = myStatement.executeQuery(sqlQuery);

while (myResult.next()){
box::info(myResult.getString(1));
}
}

Comments

n60bob9eg7 said…
Those days are over, but the quantity of} wager, in which the revenue from 카지노사이트 the primary wager is staked on the second wager and so on, nonetheless have a place in the sports activities bettors armoury. In truth, a quantity of} wager is your quickest approach to turn a small stake into a big win, so its perfect if your betting bank is small. The downside of quantity of} betting is that the mixed odds of successful are often lengthy and don’t all the time symbolize worth, but {as lengthy as|so lengthy as} you perceive the dangers involved, a quantity of} wager is commonly a good choice. Basketball is becoming even more in style for betting in Europe. You can wager on the NBA nicely as|in addition to} the European basketball leagues, including the German, Serbian, Spanish and Italian leagues. Each basketball recreation includes a multitude of sportsbetting markets with nice odds.

Popular posts from this blog

ย้ายบ้าน

ใต้ร่มกาสาวพัตร

Google Gears