WINDOWS Live Search

To contact me for any clarifications regarding any posts / information, please mail me at arijit [dot] basu [at] gmail [dot] com


Thursday, November 23, 2006

Updating external database using X++

loginProperty loginProperty = new LoginProperty();
ODBCConnection odbcConnection;
Statement sql;
ResultSet result;
;
loginProperty.setDSN('dsnName');
loginProperty.setUsername('');
loginProperty.setPassword('');
odbcConnection = new ODBCConnection(loginProperty);
if (odbcConnection)
{
sql = odbcConnection.createStatement();
result = sql.executeQuery("select * from table");
while (result.next())
{
print result.getString(1);
}

}

3 comments:

Unknown said...

When using this code, I get the following error message:

Cannot execute the required database operation. This function is no longer supported.

I'm using AX 4.0 sp1

What can I do about it?

Unknown said...

I tried to use this code to connection to a legacy application.

I got the following error:
Cannot execute the required database operation. This function is no longer supported.

I am using AX 4.0 SP1.

What can I do about it?

Unknown said...

Hi,

Using the ODBC connection to select and update a record requires 2 connections to be established.

If I try to use a global connection and use it in both the select and update statements, it gives an error "Connection is busy". On further analysis, I found that it is required to enable MARS (Multiple Active Result Sets). But I do not find any syntax, how to enable MARS through ODBC connection from X++.

Please let me know.