For some reason this code above fails for SQLColAttribute().
The value of the count is 29 and the value of i is 51 and the error is "Invalid descriptor index", which according to the MSDN means "column is out of bounds".
I am trying to connect to MS SQL Server 10.0 from MSVC 2017 on Windows 8.1. It is for "INFORMATION_SCHEMA.ROUTINES" table. Server is running on the same machine.
Can anyone please explain this?
Thank you.
Last edited by OneEyeMan; April 7th, 2021 at 12:16 AM.
LOL!
And who, how and where did set this value to be 51?
Code:
ret = SQLColumns();
ret = SQLBindColumn();
ret = SQLBindColumn();
SQLLEN autoincrement;
int i = 0;
for( ret = SQLFetch( stmt_col ); ( ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO ) && ret != SQL_NO_DATA; ret = SQLFetch( stmt_col ) )
{
// save the info about column
i++;
}
The error checking and the parameters are omitted for simplification.
For some reason this code above fails for SQLColAttribute().
The value of the count is 29 and the value of i is 51 and the error is "Invalid descriptor index", which according to the MSDN means "column is out of bounds".
I am trying to connect to MS SQL Server 10.0 from MSVC 2017 on Windows 8.1. It is for "INFORMATION_SCHEMA.ROUTINES" table. Server is running on the same machine.
And what is the column name at which the error happens?
I can't call this in a loop, because I'm binding to a different variable names.
And I did say that error checking is omitted.
Thank you.
Have you ever seen the signs advertising office space, "If you worked from here, you would be home by now"?
That's what coding up raw ODBC is like vs. using an ORM. Sure, there might be an initial learning curve but you won't have to endure the pain associated with having to write code that maps every column to the correct data type, and remember to free the handles and release the memory. Pure drudgery (and not to mention error prone).
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.