Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adodc Problem

Status
Not open for further replies.

kvant13

Programmer
Jul 9, 2003
12
GE
I have a problem with CAdodc Object.

CAdodc m_StaffData;

I Want to make same changes in CAdodc::OnWillMoveAdodc. But there's an error. Please Help.


void CStaffDetal::OnWillMoveAdodc1(long adReason, long FAR* adStatus, LPDISPATCH pRecordset)
{_variant_t fname, result;
try {
fname="name"; /
result=m_StaffData.GetRecordset().GetFields).GetItem(fname).GetValue(); //error
this->m_Person_Name=result.bstrVal; //>m_Person_Name - CString obj.
UpdateData(FALSE);
}
catch (_com_error &e)
{GenerateError(e.Error(), e.Description());}


}

Thanks

 
Hi,
you can use the following line instead of Errorline :
result=m_StaffData.GetRecordset()(fname);
 
dear BEHZADTALA
Thank you very much but
result=m_StaffData.GetRecordset()(fname); doesn't work there is an error
'error C2064: term does not evaluate to a function'

in my code there was an error in "GetFields)" but it isn,t the reason of that error
result=m_StaffData.GetRecordset().GetFields().GetItem(fname).GetValue();
 
Hi again,
you are right. maybe the following code can help you
THAT IS A EXAMPLE FROM MICROSOFT
Code:
CDaoDatabase db;
db.Open(_T("d:\\SCORES.mdb"));

CDaoRecordset rs(&db);
rs.Open(dbOpenDynaset,
       _T("Select [Student Name], AVG([Test Score]) AS AvgScore FROM 
                SCORES GROUP BY [Student Name]"));
  while (!rs.IsEOF())
  {
     COleVariant varName;
     COleVariant varAvg;
     varName= rs.GetFieldValue("student name");
     varAvg=  rs.GetFieldValue("AvgScore");
     TRACE(_T("%s\n%f\n"), V_BSTRT(&varName), V_R8      
    (&varAvg));
     rs.MoveNext();
  }
  rs.Close();
  db.Close();
 
Thank you BEHZADTALA. You are very kind. that's nice code. But it's DAO and I use ADO (ADODC). althought thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top