?? oleodbcview.cpp
字號:
// OleOdbcView.cpp : implementation of the COleOdbcView class
//
#include "stdafx.h"
#include "OleOdbc.h"
#include "OleOdbcSet.h"
#include "OleOdbcDoc.h"
#include "OleOdbcView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView
IMPLEMENT_DYNCREATE(COleOdbcView, COleDBRecordView)
BEGIN_MESSAGE_MAP(COleOdbcView, COleDBRecordView)
//{{AFX_MSG_MAP(COleOdbcView)
ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
ON_BN_CLICKED(IDC_BUTTON_INSERT, OnButtonInsert)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, COleDBRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, COleDBRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, COleDBRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView construction/destruction
COleOdbcView::COleOdbcView()
: COleDBRecordView(COleOdbcView::IDD)
{
//{{AFX_DATA_INIT(COleOdbcView)
m_pSet = NULL;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
COleOdbcView::~COleOdbcView()
{
}
void COleOdbcView::DoDataExchange(CDataExchange* pDX)
{
COleDBRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COleOdbcView)
DDX_Text(pDX,IDC_EDIT_USERID,m_pSet->m_userid,m_pSet);
DDX_Text(pDX,IDC_EDIT_PASSWORD,m_pSet->m_password,m_pSet);
//}}AFX_DATA_MAP
}
BOOL COleOdbcView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return COleDBRecordView::PreCreateWindow(cs);
}
void COleOdbcView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_oleOdbcSet;
{
CWaitCursor wait;
HRESULT hr = m_pSet->Open();
if (hr != S_OK)
{
AfxMessageBox(_T("Record set failed to open."), MB_OK);
// Disable the Next and Previous record commands,
// since attempting to change the current record without an
// open RecordSet will cause a crash.
m_bOnFirstRecord = TRUE;
m_bOnLastRecord = TRUE;
}
}
COleDBRecordView::OnInitialUpdate();
}
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView printing
BOOL COleOdbcView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void COleOdbcView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void COleOdbcView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView diagnostics
#ifdef _DEBUG
void COleOdbcView::AssertValid() const
{
COleDBRecordView::AssertValid();
}
void COleOdbcView::Dump(CDumpContext& dc) const
{
COleDBRecordView::Dump(dc);
}
COleOdbcDoc* COleOdbcView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COleOdbcDoc)));
return (COleOdbcDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView database support
CRowset* COleOdbcView::OnGetRowset()
{
return m_pSet;
}
/////////////////////////////////////////////////////////////////////////////
// COleOdbcView message handlers
void COleOdbcView::OnButtonDelete()
{
// TODO: Add your control notification handler code here
}
void COleOdbcView::OnButtonInsert()
{
// TODO: Add your control notification handler code here
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -