Hi Girish.

The following code-extract inserts records into an external database
using a ODBC connection.

Regards,
S�ren Graversen


    OdbcConnection              OdbcCon;
    str             query1;
    Statement S;
    ResultSet R;

    boolean updateOk;

    LoginProperty LP = new LoginProperty();

    str host = "pcsg2";
    ;

    LP.setDSN("SGMYSQL");
    LP.setServer(host);
    LP.setUsername("Myadmin");
    LP.setPassword("password");

    OdbcCon = new OdbcConnection(LP);

// Insert package information
    query1 = strfmt("INSERT INTO FodocWebDistTable (JournalId,
AuthId, PostedDate) VALUES ('%1', '%2', '%3')",
        replQueue.JournalId,
        authid,
        date2Str(replQueue.createdDate,321,2,3,2,3,4),
        );

    if (OdbcCon)
    {
        S = OdbcCon.createStatement();
        updateOk = S.executeUpdate(query1);
    }
    else
        error("@FOC2129");


--- In [EMAIL PROTECTED], "Girish Bhatkal"
<[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
>   whenever axapta needed to extract data from an SQL (on which
axapta is not
> running) then we can get the data using the process of
> 1. initialise the connection to the external database (connect
using ODBC)
> 2. run the SQL statement and get the executed query data in the
resultset
> 3. now by using result.next() we get the records and update in the
axapta
> table
>
>  similarly now if we want to run the opposite way i.e pickup the
data
> (multiple records) from an axapta table and then insert these
records in a
> table present in a database which is not running on axapta how to
do this?
>           if anyone know how to achieve this please let me know.
>
> thanks
>
> Girish


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to