This'll be quick for an expert: CRecordset crashes, 4 lines ofcode...
Here's my complete code, which according to everything I've seen
bool ok = db.Open( szDSN ); // szDSN contains a valid ODBC
this returns true
CRecordset rs( &db );
rs.Open( AFX_DB_USE_DEFAULT_TYPE, _T("Select * from
ok is true, and rs.Open throws an exception because no rows are
returned. (There's a MoveNext() that fails in Open()). The select
statement returns a few rows when ran from SQL Analyzer.
If the reason is that I do not bind parameters, I do not want to. I am
trying to build a generic way to have a SQL statement fill a
CRecordset, in which I will get the column names after it's filled.
1- There's something wrong with my code above, or
2- I'm going at this the wrong way. Could you please recommend a
different tool/class to do this? My bounds are VC++ 6 and MFC, MS SQL
2005. I want to make no assumption on the returned fields before
opening the dataset.