Click to See Complete Forum and Search --> : CRecordset::GetFieldValue() for dataset generated by a join condition


April 21st, 1999, 02:49 AM
Hi,

I'm trying to get the value from a field, which is part of a result set
generated by a join condition.
The result set consists out of 2 columns, and is generated by following
code:

CMyRS lRS(m_pMyDB);
lRS.m_UserIdParam = aUserID;
lRS.m_strFilter = "ITStaticUserSettings.user_id = ?";
lRS.Open(CRecordset::snapshot,_T("select
ITStaticUserSettings.account,ITSystemSettings.server from
ITSystemSettings,ITStaticUserSettings"),CRecordset::readOnly))

While executing this:

CString lServer;
lRS.GetFieldValue("server",lServer);

debugging the MFC source, resulted in this information:

"[Microsoft][ODBC Cursor Library] Positioned request cannot be performed
because result set was generated by a join condition"
SL002

While executing this:

CString lServer;
lRS.GetFieldValue("ITSystemSettings.server",lServer);

I got an assert because GetFieldIndexByName() a function called from within
GetFieldValue() did not find the field "ITSystemSettings.server", it was
looking for a field named "server" instead.

Is it possible to create a CRecordset derived class which can handle
accessing a dataset retrieved from multiple tables?

Thanks,