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

📄 jiludlg.cpp

📁 自己帮家里人写的一个废品收购管理数据库系统
💻 CPP
字号:
// JiLuDlg.cpp : implementation file
//

#include "stdafx.h"
#include "废品收购管理系统.h"
#include "JiLuDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJiLuDlg dialog


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

	//{{AFX_DATA_INIT(CJiLuDlg)
	m_tjwp = _T("");
	m_tjfk = _T("");
	m_tjjs = _T("");
	m_tjsj = _T("");
	m_tjje = _T("");
	m_tjdd = _T("");
	//}}AFX_DATA_INIT
}


void CJiLuDlg::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 CJiLuDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJiLuDlg)
	DDX_CBString(pDX, IDC_COMBO_TJ_WP, m_tjwp);
	DDX_Text(pDX, IDC_EDIT_TIANJIA_JL_FK, m_tjfk);
	DDX_Text(pDX, IDC_EDIT_TIANJIA_JL_JS, m_tjjs);
	DDX_Text(pDX, IDC_EDIT_TIANJIA_JL_SJ, m_tjsj);
	DDX_Text(pDX, IDC_EDIT_TJJE, m_tjje);
	DDX_Text(pDX, IDC_EDIT_TJ_DD, m_tjdd);
	//}}AFX_DATA_MAP
}


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

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

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

// {019A4807-912D-433E-9EEA-477932A3D685}
static const IID IID_IJiLuDlg =
{ 0x19a4807, 0x912d, 0x433e, { 0x9e, 0xea, 0x47, 0x79, 0x32, 0xa3, 0xd6, 0x85 } };

BEGIN_INTERFACE_MAP(CJiLuDlg, CDialog)
	INTERFACE_PART(CJiLuDlg, IID_IJiLuDlg, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJiLuDlg message handlers

BOOL CJiLuDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
    CoInitialize(NULL);
	_ConnectionPtr pCon(_uuidof(Connection));
	_RecordsetPtr  pRec(_uuidof(Recordset));

	pCon->ConnectionTimeout=5;
    pCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=废品交易数据库.mdb","","",adModeUnknown);

	CString strSQL;
	strSQL.Format("SELECT * FROM 交易物品表");
	pRec->Open(_bstr_t(strSQL),
			        _variant_t((IDispatch*)pCon,true),
					adOpenStatic,
					adLockOptimistic,
					adCmdText					
					);

	while(!pRec->adoEOF)
	{
		((CComboBox*)GetDlgItem(IDC_COMBO_TJ_WP))->AddString(_bstr_t(pRec->GetCollect("交易物品")));
		pRec->MoveNext();
	}

	((CComboBox*)GetDlgItem(IDC_COMBO_TJ_WP))->SetCurSel(0);
	

	pRec->Close();
	pCon->Close();
	pRec.Release();
	pCon.Release();
	CoUninitialize();	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

//DEL void CJiLuDlg::OnOk() 
//DEL {
//DEL 	// TODO: Add your control notification handler code here
//DEL     	UpdateData(TRUE);
//DEL 		
//DEL 		CoInitialize(NULL);
//DEL 	    _ConnectionPtr pCon(_uuidof(Connection));
//DEL 	    _RecordsetPtr  pRec(_uuidof(Recordset));
//DEL 
//DEL 	    pCon->ConnectionTimeout=5;
//DEL         pCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=废品交易数据库.mdb","","",adModeUnknown);
//DEL         CString strSQL;
//DEL 		strSQL.Format("SELECT * FROM 交易记录表");	
//DEL 	    pRec->Open(_bstr_t(strSQL),
//DEL 			        _variant_t((IDispatch*)pCon,true),
//DEL 					adOpenStatic,
//DEL 					adLockOptimistic,
//DEL 					adCmdText					
//DEL 					);
//DEL 		pRec->AddNew();
//DEL         pRec->PutCollect("公司编号",_variant_t((long)(m_bianhao2)));
//DEL     	pRec->PutCollect("交易时间",_variant_t(m_tjsj));
//DEL     	pRec->PutCollect("交易地点",_variant_t(m_tjdd));
//DEL         pRec->PutCollect("交易物品",_variant_t(m_tjwp));
//DEL         pRec->PutCollect("经手人",_variant_t(m_tjjs));
//DEL         pRec->PutCollect("付款情况",_variant_t(m_tjfk));
//DEL 		pRec->PutCollect("交易金额",_variant_t(m_tjje));
//DEL     	pRec->Update();		
//DEL 		pRec->Close();
//DEL 	    pCon->Close();
//DEL 	    pRec.Release();
//DEL 	    pCon.Release();
//DEL 	    CoUninitialize();
//DEL 		MessageBox("添加交易记录成功!");
//DEL 		OnOK();
//DEL 
//DEL 	
//DEL }

⌨️ 快捷键说明

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