searchmaterial.cpp

来自「是关于SQL的一些程序 很好很经典的~大家又兴趣的可以学习下」· C++ 代码 · 共 78 行

CPP
78
字号
// SearchMaterial.cpp : implementation file
//

#include "stdafx.h"
#include "仓库管理系统.h"
#include "SearchMaterial.h"

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

extern CShow* showdlg;
/////////////////////////////////////////////////////////////////////////////
// CSearchMaterial dialog


CSearchMaterial::CSearchMaterial(CWnd* pParent /*=NULL*/)
	: CDialog(CSearchMaterial::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSearchMaterial)
	m_from = 0;
	m_to = 0;
	m_name = _T("");
	m_mark = _T("");
	//}}AFX_DATA_INIT
}


void CSearchMaterial::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSearchMaterial)
	DDX_Control(pDX, IDC_CHECK3, m_checkmark);
	DDX_Control(pDX, IDC_CHECK2, m_checkname);
	DDX_Control(pDX, IDC_CHECK1, m_checknum);
	DDX_Text(pDX, IDC_EDIT1, m_from);
	DDX_Text(pDX, IDC_EDIT2, m_to);
	DDX_Text(pDX, IDC_EDIT3, m_name);
	DDX_Text(pDX, IDC_EDIT4, m_mark);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSearchMaterial, CDialog)
	//{{AFX_MSG_MAP(CSearchMaterial)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSearchMaterial message handlers

void CSearchMaterial::OnButton1() 
{
	CString sql;
	char buf[100];
	CString temp;
	UpdateData(true);
	sql.Format("select * from 物资表 where 物资号>=0");
	if(m_checknum.GetCheck()){
		temp.Format(" and 物资号 between %d and %d",m_from,m_to);
		
		sql=sql+temp;
		//MessageBox(sql);
		//sql=sql+" and 物资号 between '"+itoa(m_from,buf,10)+"' and '"+itoa(m_to,buf,10)+"'";
	}
	if(m_checkname.GetCheck()){
		sql=sql+" and 物资名称 like '%"+m_name+"%'";
	}
	if(m_checkmark.GetCheck()){
		sql=sql+" and 备注 like '%"+m_mark+"%'";
	}
	showdlg->OnRefreshData(sql);
	CDialog::OnOK();
}

⌨️ 快捷键说明

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