⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 occi2view.cpp

📁 这是书上的代码
💻 CPP
字号:
// OCCI2View.cpp : implementation of the COCCI2View class
//

#include "stdafx.h"
#include "OCCI2.h"

#include "OCCI2Doc.h"
#include "OCCI2View.h"

#include "occiph.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// COCCI2View

IMPLEMENT_DYNCREATE(COCCI2View, CView)

BEGIN_MESSAGE_MAP(COCCI2View, CView)
	//{{AFX_MSG_MAP(COCCI2View)
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COCCI2View construction/destruction

COCCI2View::COCCI2View()
{
	// TODO: add construction code here

}

COCCI2View::~COCCI2View()
{
}

BOOL COCCI2View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// COCCI2View drawing

void COCCI2View::OnDraw(CDC* pDC)
{
	COCCI2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// COCCI2View printing

BOOL COCCI2View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void COCCI2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void COCCI2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// COCCI2View diagnostics

#ifdef _DEBUG
void COCCI2View::AssertValid() const
{
	CView::AssertValid();
}

void COCCI2View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

COCCI2Doc* COCCI2View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COCCI2Doc)));
	return (COCCI2Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// COCCI2View message handlers

void COCCI2View::OnLButtonDown(UINT nFlags, CPoint point) 
{
  
  MessageBox("进行数据库链接!",NULL,MB_OK);
  OCCIPH *demo = new OCCIPH ("SCOTT", "TIGER", "PH"); 

  if(demo->callproc("CREATE TABLE author_tab(author_id NUMBER(10),author_name VARCHAR2(10))"))
  {
      MessageBox("表创建成功!未添加记录!",NULL,MB_OK);
  }else
  {
	   MessageBox("表已经存在,正在添加记录!",NULL,MB_OK);
  demo->callproc(
	  "DECLARE "
	    "v_item_code number(10);"
	    "v_item_descr VARCHAR2(10);"
	  "BEGIN  "
	    "v_item_code :=231;"
	    "v_item_descr :='Spareparts';"
	    "INSERT INTO author_tab VALUES (v_item_code, v_item_descr);"
	  "END;"
	  );
     MessageBox("记录已经添加成功!",NULL,MB_OK);
  }
  delete demo;//"  
  CView::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -