我用用
CString strSQL;
strSQL = "Alter Table name Add ying varchar(10) null";
db.ExecuteSQL(strSQL);
增加了一个字段,那么请问,我如何修改和显示这个字段的内容???
我用的是ODBC方式,ACCESS数据库,由于我是新手,请高手把代码写出来,谢谢!!

解决方案 »

  1.   

    不知道ODBC怎么做,用ADO实现起来比较方便
      

  2.   

    我觉得应该在QueryResult事件的响应函数里面做。
    你要用什么控件显示数据?
      

  3.   

    strSQL = "Alter Table name Add ying TEXT(10) null";
    这个语句吧用CRecordset的GetFieldValue和SetFieldValue
      

  4.   

    各位大哥,GetFieldValue是怎么用的啊,小弟的硬盘太小(4G),装不下MSDN,书上又没有,麻烦大家了。
      

  5.   

    GetFieldValue,   读取字段名对应的值,
    添个硬盘吧。
      

  6.   

    ASSERT(m_recordset.IsOpen());
    int nCount=m_recordset.GetODBCFieldCount();
        CODBCFieldInfo fInfo;
    CString str;
    // ASSERT(m_recordset!=NULL);

    for(int i=0;i<nCount;i++)
    {  
    m_recordset.GetODBCFieldInfo(i,fInfo);
            m_list.InsertColumn(i,fInfo.m_strName,LVCFMT_LEFT, 100); 
          
    } while(!m_recordset.IsEOF())

    int k=0;
    m_recordset.GetFieldValue(k,str);
    m_list.InsertItem(k, str); 
            for(int j=1;j<nCount;j++)
    {
                 m_recordset.GetFieldValue(j,str);
     m_list.SetItemText(k,j,str);             
    }
    k++;
    m_recordset.MoveNext();
    }