SQLBindParameter/SQLExecute returns SQL_NO_DATA on second iteration
Hi, ALL,
I'm trying to run the following scenario:
std::wstring query = L"INSERT INTO abcattbl SELECT ?, ?, (SELECT object_id FROM sys.objects o, sys.schemas s WHERE s.schema_id = o.schema_id AND o.name = ? AND s.name = ?), '', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', '' WHERE NOT EXISTS(SELECT * FROM dbo.abcattbl WHERE abt_tnam=? AND abt_ownr=?);";
SQLTables( stmt1 );
SQLPrepare( stmt2, query );
for( SQLFetch() )
{
// SQLBindParameter() calls
SQLExecute( stmt2 );
}
Problem is everything runs fine only first time. The second time I'm querting SQL_NO_DATA.
I even tried to add call to SQLFreeStmt( stmt2, SQL_RESET_PARAMS ); but without success.
Could someone explain what needs to be done in order to successfully rebind and re-run the query?
Thank you,