Lennart Conrad <[EMAIL PROTECTED]> wrote:
Hi Daniel
If you want to execute DELETE/INSERT/UPDATE etc. you must use the executeUpdate() method instead.
Lennart Conrad
Microsoft Business Solutions
This posting is provided "AS IS" with no warranties, and confers no rights.
From: daniel lim [mailto:[EMAIL PROTECTED]
Sent: 16. marts 2005 10:47
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] execute a SQL string in Axapta 3.0
hi Lennart,
it works for select statement, but not with delete statement. my example as follow inside job:
{
Connection Con = new Connection();
Statement Stmt = Con.createStatement();
ResultSet R = Stmt.executeQuery('delete FROM TableAwhere CustomerCode = \'AAI\'');
}
thx.
daniel
Lennart Conrad <[EMAIL PROTECTED]> wrote:Hi Daniel
The following is taken from the documentation of the Statement class (\System Documentation\Classes\Statement)
Description
A Statement object is used for executing a static SQL statement and obtaining the results it produces.
Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements.Remarks
All statement execute methods implicitly close a statement's current ResultSet if an open one exists.
Example
{
Connection Con = new Connection();
Statement Stmt = Con.createStatement();
ResultSet R = Stmt.executeQuery('SELECT VALUE FROM
SQLSYSTEMVARIABLES');
while ( R.next() )
{
print R.getString(1);
}
}
As I mentioned earlier you cannot use the Statement class if you want to execute X++ sql syntax
Lennart Conrad
Microsoft Business Solutions
This posting is provided "AS IS" with no warranties, and confers no rights.
From: daniel lim [mailto:[EMAIL PROTECTED]
Sent: 16. marts 2005 08:37
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] execute a SQL string in Axapta 3.0
hi Lennart,
i'm not really understand what u mean by system class statement?
i get solution from other group's member to suggest using something like:
xppCompiler compiler = new xppCompiler(); str sql = 'void sql{select .....}'
if(compiler.compile)
runbuf(sql);
but it seems not working perfectly when i try in job cos the compiler.compile requesting param "str source". i've post this to him but no respond yet.
u have any idea on this?will appreciate if u can provide an example.
rgds,
daniel
Lennart Conrad <[EMAIL PROTECTED]> wrote:Hi Daniel
Take a look at the system class Statement and its documentation. Note that the SQL syntax should be “real” SQL and not Axapta sql
Lennart Conrad
Microsoft Business Solutions
This posting is provided "AS IS" with no warranties, and confers no rights.
From: daniellim_yh [mailto:[EMAIL PROTECTED]
Sent: 16. marts 2005 05:05
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: [Axapta-Knowledge-Village] execute a SQL string in Axapta 3.0
hi all,
in Axapta, can i do execution to a string like this:
TempTableA _Tmp_Tbl; //TempTableA is Temp table in Axapta
Exprstr = "delete_from _Tmp_Tbl where _Tbl.field1 == 'A'";
then execute this query.
i need the syntax to execute it. the reason i do like this because
the string is a dynamically generated SQL string. i m using Axapta
3.0.
pls help n thx in advance.
rgds,
daniel
Sharing the knowledge on Axapta.
Sharing the knowledge on Axapta.
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
Sharing the knowledge on Axapta.
Sharing the knowledge on Axapta.
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more.
Sharing the knowledge on Axapta.
Sharing the knowledge on Axapta.
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
Sharing the knowledge on Axapta.
Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/Axapta-Knowledge-Village/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.