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

📄 xiugai.cpp

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CXiuGai dialog


CXiuGai::CXiuGai(CWnd* pParent /*=NULL*/)
	: CDialog(CXiuGai::IDD, pParent)
{
	//{{AFX_DATA_INIT(CXiuGai)
	m_newuser1 = _T("");
	m_newuser2 = _T("");
	//}}AFX_DATA_INIT
}


void CXiuGai::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CXiuGai)
	DDX_Control(pDX, IDC_EDIT_NEWUSER2, m_newuser22);
	DDX_Control(pDX, IDC_EDIT_NEWUSER1, m_newuser11);
	DDX_Text(pDX, IDC_EDIT_NEWUSER1, m_newuser1);
	DDX_Text(pDX, IDC_EDIT_NEWUSER2, m_newuser2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CXiuGai, CDialog)
	//{{AFX_MSG_MAP(CXiuGai)
	ON_BN_CLICKED(ID_OK, OnOk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CXiuGai message handlers

void CXiuGai::OnOk() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	if((m_newuser1=="") || (m_newuser2==""))
	{
        MessageBox("用户名不能为空!");
		m_newuser1="";
		m_newuser2="";
        m_newuser11.SetFocus();
	}
	else if(m_newuser1!=m_newuser2)
	{
		MessageBox("两次输入的用户名要一致!");
		m_newuser1="";
		m_newuser2="";
        m_newuser11.SetFocus();
	}
	else
	{
        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;
		_bstr_t bstrtemp;
		strSQL.Format("UPDATE 用户名与密码表 SET 用户名='"+m_newuser1+"'");
		bstrtemp=strSQL;
		pRec=pCon->Execute(bstrtemp,NULL,adCmdText);
		MessageBox("修改用户名成功!");
		OnOK();

		//pRec->Close();
	    pCon->Close();
	    pRec.Release();
	    pCon.Release();
	    CoUninitialize();
	}
}

⌨️ 快捷键说明

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