|
这个整了很多麻烦的事情。。。记号,
void CSyslogDlg::FindLog()
{
CTime dtStartDate,dtStartTime;
CTime dtEndDate,dtEndTime;
m_date1.GetTime(dtStartDate);
m_time1.GetTime(dtStartTime);
m_date2.GetTime(dtEndDate);
m_time2.GetTime(dtEndTime);
CString strUser;
int nIndex = m_ctrlUser.GetCurSel();
if (CB_ERR != nIndex)
m_ctrlUser.GetLBText(nIndex,strUser);
if(strUser.IsEmpty()) return;
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString sql;
sql.Format(_T("SELECT tbrz.sj,tbrz.czy,tbrz.nr FROM tbrz where czy='%s' and sj between CDate('%s %s') and CDate('%s %s')"),
strUser,
dtStartDate.Format(_T("%x")), dtStartTime.Format(_T("%X")),
dtEndDate.Format(_T("%x")), dtEndTime.Format(_T("%X")));
TRACE(sql);
int i = 0;
_RecordsetPtr pRecordset;
pRecordset = m_AdoConn.GetRecordset((_bstr_t)sql);
m_wndList.DeleteAllItems();
while (!pRecordset->adoEOF)
{
CString str;
str.Format(_T("%d"), i);
m_wndList.InsertItem(i, str);
m_wndList.SetItemText(i,1,(TCHAR *)(_bstr_t)pRecordset->GetCollect("czy"));
m_wndList.SetItemText(i,2,(TCHAR *)(_bstr_t)pRecordset->GetCollect("sj"));
m_wndList.SetItemText(i,3,(TCHAR *)(_bstr_t)pRecordset->GetCollect("nr"));
pRecordset->MoveNext();
i++;
}
m_AdoConn.ExitConnect();
}
|
|