16,548
社区成员




void CSelectFieldCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("aaa");
CChooseDialog dialog;
dialog.DoModal();
COleControl::OnLButtonUp(nFlags, point);
}
.cpp中
// TODO: Add extra initialization here
CString strConnection;
//strConnection.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;")
//_T("Data Source=note.mdb"));
strConnection.Format(_T("Provider=SQLOLEDB;Server=dataserver.;Database=youdb;uid=sa;pwd=youpassword"));
m_DBCn.Open((LPCTSTR)strConnection); //打开程序数据库
m_Rs.SetDatabase(&m_DBCn);
m_Rs.Open(_T("select * from yourtables;"));
m_ctrlDG.SetCaption(_T("单击列头进行排序"));//m_ctrlDG.为datagrid的变量。
m_ctrlDG.SetRefDataSource((LPUNKNOWN)m_Rs.GetRecordset());
void CSelectFieldCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog dlgAbout1(IDD_SELECTDLG);
dlgAbout1.DoModal();
CDialog dlgAbout(IDD_ABOUTBOX_SELECTFIELD);
dlgAbout.DoModal();
COleControl::OnLButtonUp(nFlags, point);
}
CChooseDialog dialog;
dialog.DoModal();