我有如下的程序段
_variant_t     vID = m_pRecordset->GetCollect("ID");
现在我想在一个editbox里面显示vID的值该怎么办?
editbox的ID是IDC_ID,为int型,变量定义为m_nID谢谢高人指点!

解决方案 »

  1.   

    这要看你的数据库中是什么类型。如果数据库中字段“ID”的类型也为int。那么如下:
                       m_nID=vID.intVal;
    然后调用:UpdateData(false);让editbox显视数据即可。
      

  2.   

    ::SetDlgItemInt(hwnd, IDC_ID, int);
      

  3.   

    只是显示值, 不是赋值的话, 直接当作edit控件的标题好了, 呵呵
    CWnd::SetDlgItemText
    void SetDlgItemText( int nID, LPCTSTR lpszString );ParametersnIDIdentifies the control whose text is to be set.lpszStringPoints to a CString object or null-terminated string that contains the text to be copied to the control.ResSets the caption or text of a control owned by a window or dialog box.