void CExampleDlg::OnConnect() 
{
// TODO: Add your control notification handler code here
    m_Set=new CRecordset(&m_DB);
if(!m_DB.OpenEx(_T("DSN=StuInfo6"),0))//连接数据源
{
AfxMessageBox("打开数据源失败!!");//报告错误
return;
}
if(!m_Set->IsOpen())
{
m_Set->Open(CRecordset::dynaset,_T("Select * from 表1"));//选择数据表并打开
}
    if(m_Set->IsEOF())//记录集是否为空
{
AfxMessageBox("记录集没有记录");
return;
}
m_Set->MoveFirst();//第一个记录
int i=0;
int n;
    CString  A(n,3);
while(!m_Set->IsOpen())
{
       m_Set->GetFieldValue((short)0,A(i,0));//把第0 列赋给此控件
        m_Set->GetFieldValue((short)1,A(i,1));//把第1 列赋给此控件
        m_Set->GetFieldValue((short)2,A(i,2));//把第2 列赋给此控件 
i++;
     m_Set->MoveNext();
}
}错误: : error C2064: term does not evaluate to a function
 : error C2064: term does not evaluate to a function
  : error C2064: term does not evaluate to a function

解决方案 »

  1.   

    要VB,VC都懂咯~
    Dim mlink As String ->  CString mlink
    很多函数都不一样,
      

  2.   

    高一时研究过一段时间的 VB ,现在有三四年没学了,早已忘得差不多了。最近在自学 MFC ,对于 ADO 这一块略懂一点。
    下面的代码楼主凑合着看着啊:
    void func(...)
    {
    int i,j,m,n,k,d,e;
    //网上说,vb里面的single相当于c里面的float,我就这样用好了
    float **A;
    CString mlink,mpath,macc;
    _ConnectionPtr conn;
    _RecordsetPtr rst;
    mlink = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 系统测试.mdb";
    macc = "select * from 股票系统测试表 where 代码 = '" + d + "'";
    conn->Open(mlink,...);
    rst->Open(macc,conn,adLockPessimistic,...);
    rst->MoveLast();
    j = Rst.RecordCount - 1;
    i = Rst.Fields.Count - 1;
    A = new float[i][j];
    e = 45;
    for(n=0;n<=j;n++)
    {
    if(n > 0)
    rst->MoveNext();
    {
    if(rst.EOF)
    rst->MoveLast();
    }
    else
    rst->MoveFirst();
    for(m=0;m<i;m++)
    A[m][n] = rst->GetFields()->GetItem(m)->GetValue();
    }
    conn->Close();
    }
    有...的地方需要自己去补充参数。
    建议楼主自己再改改。
      

  3.   

    3楼的非常感谢,这段时间在学ODBC,对ADO不了解,一定会试一试你给的代码,过一段时间给分。