📄 dlgticket.cpp
字号:
// DlgTicket.cpp : implementation file
//
#include "stdafx.h"
#include "AirServer.h"
#include "DlgTicket.h"
#include "ADOConn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgTicket dialog
CDlgTicket::CDlgTicket(CWnd* pParent /*=NULL*/)
: CDialog(CDlgTicket::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgTicket)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgTicket::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgTicket)
DDX_Control(pDX, IDC_TicketList, m_TicketList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgTicket, CDialog)
//{{AFX_MSG_MAP(CDlgTicket)
ON_BN_CLICKED(ID_TICKIT_P, OnTickitP)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgTicket message handlers
BOOL CDlgTicket::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_TicketList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
CTime tm;
tm=CTime::GetCurrentTime();
CString strTm;
strTm.Format("%d-%d-%d",tm.GetYear(),tm.GetMonth(),tm.GetDay());
ADOConn adoConn;
_RecordsetPtr m_pRs,m_Rs;
_bstr_t vsql="select * from SList where 起飞日期='"+strTm+"'";
adoConn.OnInitADOConn();
try{
m_pRs=adoConn.GetRecordSet(vsql);
m_Rs=m_pRs;
int nCols=0;
if(!m_Rs->adoEOF)
{
FieldsPtr pFds;
pFds=m_Rs->GetFields();
nCols=pFds->GetCount(); //得到列数
for(int row=0;row<nCols;row++)
m_TicketList.InsertColumn(row,pFds->GetItem((long)row)->GetName(),LVCFMT_LEFT,80);
}
while(!m_pRs->adoEOF)
{
int i=0;
m_TicketList.InsertItem(i,(LPCTSTR)(_bstr_t)m_pRs->GetCollect((long)0));
for(int j=1;j<nCols;j++)
m_TicketList.SetItemText(i,j,(LPCTSTR)(_bstr_t)m_pRs->GetCollect((long)j));
i++;
m_pRs->MoveNext();
}
}catch(_com_error e){
AfxMessageBox(e.Description());
}
adoConn.ExitConnect();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgTicket::OnTickitP()
{
// TODO: Add your control notification handler code here
MessageBox("请添加打印机...");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -