Does DataDirect ODBC to Sybase ASE support dynamic sql statm

Posted by samchen on 16-Jun-2014 23:06

I want to insert rows using loop, but it seems not work in DataDirect (but Sybase ODBC Driver and TDS works)

dbStatement<<"INSERT INTO CSMRECOVER VALUES(?,0,0)",use(groupNo);

 for (groupNo=0; groupNo < numOfGroup; groupNo++) {

                     dbStatement.execute();

I set DescribeAtPrepare=1 and it still not work.

DataDirect Version : 7.1.3   DB: Sybase ASE 15.0.3

Does DataDirect ODBC to Sybase ASE support dynamic sql statment?

All Replies

Posted by Jayakhanna P (JK) on 17-Jun-2014 01:21

Is the below statement inside the for loop ? Not clear from the above whether the statement is inside the for loop. Please try putting it inside the for loop, in case it's not there already

dbStatement<<"INSERT INTO CSMRECOVER VALUES(?,0,0)",use(groupNo);

Regards,

~JK

Posted by Bruce Rudd on 17-Jun-2014 07:22

What happens when you execute the example you provided?  Do you get an error message?

Posted by samchen on 17-Jun-2014 18:12

The result is :

The ? values remain consistent in the loop, so insert table will got dulplicate key after the second insert attempt.

I expect it will generate sequecne number in each insert command under the loop

This thread is closed