I keep searching for insight into what's wrong with this but can't find it; it is probably something dumb that I'm overlooking. I hope you can see it!
I have a while loop in a C++ pgm where I am loading SQL Server data using ODBC into 3 different arrays (1 for each column). If I increment the array counter outside the while loop (above in the code, commented out), of course it doesn't advance the array entries, but it does not blow up. If I move the increment (rowNum++) into the while loop (as shown), I get a stackoverflow exception. Can anyone give me a hint please? Thanks much!
else {
short iptMKTNUM;
short iptDAYNUM;
float iptPX;
int rowNum = 0;
//rowNum++;
while (SQLFetch(SQLStatementHandle) == SQL_SUCCESS) {
SQLGetData(SQLStatementHandle, 1, SQL_C_DEFAULT, &iptMKTNUM, sizeof(iptMKTNUM), NULL);
SQLGetData(SQLStatementHandle, 2, SQL_C_DEFAULT, &iptDAYNUM, sizeof(iptDAYNUM), NULL);
SQLGetData(SQLStatementHandle, 3, SQL_C_FLOAT, &iptPX, sizeof(iptPX), NULL);
MktNum[rowNum] = iptMKTNUM;
DayNum[rowNum] = iptDAYNUM;
Price[rowNum] = iptPX;
cout << "Mkt/Day/Px IS " << iptMKTNUM << " " << iptDAYNUM << " " << iptPX << endl;
cout << "Mkt/Day/Px IS " << MktNum[rowNum] << " " << DayNum[rowNum] << " " << Price[rowNum] << endl;
cout << "rowNum is " << rowNum << endl;
rowNum++;
}
}