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

📄 selnewbook9.cpp

📁 图书管理系统可进行查询,添加,修改,等操作 用树行结构为图书馆进行图书分类
💻 CPP
字号:
// selnewbook9.cpp : implementation file
//

#include "stdafx.h"
#include "图书管理.h"
#include "selnewbook9.h"
#include"newbookdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// selnewbook9 dialog


selnewbook9::selnewbook9(CWnd* pParent /*=NULL*/)
	: CDialog(selnewbook9::IDD, pParent)
{
	EnableAutomation();

	//{{AFX_DATA_INIT(selnewbook9)
	m_bookname = _T("");
	m_bussname = _T("");
	m_time = _T("");
	//}}AFX_DATA_INIT
}


void selnewbook9::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CDialog::OnFinalRelease();
}

void selnewbook9::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(selnewbook9)

	DDX_Control(pDX, IDC_ADODC1, m_adoc);
	DDX_Control(pDX, IDC_DATAGRID1, m_grid);
	DDX_Text(pDX, IDC_EDIT1, m_bookname);
	DDX_Text(pDX, IDC_EDIT2, m_bussname);
	DDX_Text(pDX, IDC_EDIT4, m_time);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(selnewbook9, CDialog)
	//{{AFX_MSG_MAP(selnewbook9)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(selnewbook9, CDialog)
	//{{AFX_DISPATCH_MAP(selnewbook9)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_Iselnewbook9 to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {348FCD70-C9EB-4BFA-A09A-4F09AD8F7C98}
static const IID IID_Iselnewbook9 =
{ 0x348fcd70, 0xc9eb, 0x4bfa, { 0xa0, 0x9a, 0x4f, 0x9, 0xad, 0x8f, 0x7c, 0x98 } };

BEGIN_INTERFACE_MAP(selnewbook9, CDialog)
	INTERFACE_PART(selnewbook9, IID_Iselnewbook9, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// selnewbook9 message handlers

void selnewbook9::OnOK() 
{
	// TODO: Add extra validation here
		// TODO: Add extra validation here
	UpdateData(true);
	CString vSQL,string,string2;
	int i,count=0;
	CString str[3],str2[3];
	str[0]=m_bookname;      str2[0]="bookname";
	str[1]=m_bussname;      str2[1]="bussname";
    str[2]=m_time;          str2[2]="tim";
	 vSQL="select * from newbook  where ";
 for(i=0;i<3;i++)
 {
	 string=""; 
     string2="";
		 if(str[i]!="")
		 {  
			 string=str2[i]+"=";
			 
			 switch(i)
			 {
			 case 0: string2="'"+m_bookname+"'";count++;break;
             case 1: string2="'"+m_bussname+"'";count++;break;
             case 2: string2="'"+m_time+"'";count++;break;
	
			 }
			 if(count>1)
             vSQL+=" AND "+string+string2;
			 else
               vSQL+=string+string2;
		 } 
 }

    string=vSQL;
	m_adoc.SetRecordSource(string);
    m_adoc.Refresh();
   
	
}

void selnewbook9::OnCancel() 
{
	// TODO: Add extra cleanup here
	
  newbookdlg dlg;
  dlg.DoModal();
}

⌨️ 快捷键说明

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