|
I have found the problem with the SetSqlAttr function.
I needed to specify the "value" keyword on the prototype for the pointer being
passed.
Now I can set the attributes correctly (I think), but when I call the
SQLExtendedFetch function, I get a SQ99999 message with Error Type 10.
Error type 10 is function sequence error.
Below is the code I am using:
rc = SQLAllocHandle (SQL_HANDLE_STMT : hdbc : hstmt);
TRUE = SQL_TRUE;
DYNAMIC = SQL_CURSOR_DYNAMIC;
// Set number of rows to return
Rc = SQLSetStmtAttr (hstmt :
SQL_ATTR_CURSOR_SCROLLABLE :
%ADDR(TRUE) :
0 );
Rc = SQLSetStmtAttr (hstmt :
SQL_ATTR_CURSOR_TYPE :
%ADDR(DYNAMIC) :
0 );
Rc = SQLSetStmtAttr (hstmt :
SQL_ATTR_ROWSET_SIZE :
%ADDR(Rows_to_Fetch) :
0 );
szSqlStr = SQL_Select_Stmt + '''RAN'''; // Load SQL Statement to execute
cbSqlStr = SQL_NTS; // Length
rc = SQLExecDirect(hstmt : // Handle
szSqlStr : // Statement
cbSqlStr ); // Length
//**********************************************************
// bind columns
//**********************************************************
rc = SQLBindCol(hstmt : // Handle
1 : // Column Number
SQL_C_CHAR : // Data Type
pNumber : // Pointer to Field
%Size(Number): // Buffer Length
pcbValue); // Bytes available for data
rc = SQLBindCol(hstmt : // Handle
2 : // Column Number
SQL_C_CHAR : // Data Type
pName : // Pointer to Field
%Size(Name ) : // Buffer Length
pcbValue); // Bytes available for data
//**********************************************************
// process all rows in result set
//**********************************************************
%Occur(Customer_Data)= 1;
Rows_to_Fetch = %Elem(Customer_Data);
rc = SQLExtendedFetch (hstmt : // Handle
SQL_FETCH_NEXT : // Type of fetch
0 : // Offset for data
Rows_Returned : // Rows Retreived
Row_Status ); // Status of Rows
Any suggestions would be greatly appreciated.
Thanks,
Jeff Young
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.