📄 returnbook.cpp
字号:
// returnbook.cpp : implementation file
//
#include "stdafx.h"
#include "booksystem.h"
#include "returnbook.h"
#include"sql.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Creturnbook dialog
SQL sql2;
Creturnbook::Creturnbook(CWnd* pParent /*=NULL*/)
: CDialog(Creturnbook::IDD, pParent)
{
//{{AFX_DATA_INIT(Creturnbook)
m_sname = _T("");
//}}AFX_DATA_INIT
}
void Creturnbook::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Creturnbook)
DDX_Control(pDX, IDC_showlianjie, m_showlianjie);
DDX_Text(pDX, IDC_sname, m_sname);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Creturnbook, CDialog)
//{{AFX_MSG_MAP(Creturnbook)
ON_BN_CLICKED(IDC_lianjie, Onlianjie)
ON_BN_CLICKED(IDC_tijiao, Ontijiao)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Creturnbook message handlers
void Creturnbook::Onlianjie()
{
// TODO: Add your control notification handler code here
CString str;
str="DRIVER={SQL Server};SERVER=(local);Database=book;UID=fatman;PWD=lucky";
sql2.m_db.OpenEx(str,0);
if(sql2.m_db.IsOpen())m_showlianjie.SetWindowText("Connect is ok");
else m_showlianjie.SetWindowText("Oh,No!");
}
void Creturnbook::Ontijiao()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CString str;
str="delete from booksystem where sname='"+m_sname+"'";
sql2.m_db.ExecuteSQL(str);
if(sql2.m_db.CanUpdate())
MessageBox("Insert ok");
else MessageBox("oh,no");
}
void Creturnbook::OnButton3()
{
// TODO: Add your control notification handler code here
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -