seventeean_dialog.cpp

来自「对医院的药品进行管理」· C++ 代码 · 共 70 行

CPP
70
字号
// seventeean_dialog.cpp : implementation file
//

#include "stdafx.h"
#include "医药管理系统.h"
#include "seventeean_dialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// seventeean_dialog dialog


seventeean_dialog::seventeean_dialog(CWnd* pParent /*=NULL*/)
	: CDialog(seventeean_dialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(seventeean_dialog)
	m_VipUserNum = _T("");
	//}}AFX_DATA_INIT
}


void seventeean_dialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(seventeean_dialog)
	DDX_Text(pDX, IDC_EDIT1, m_VipUserNum);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// seventeean_dialog message handlers

void seventeean_dialog::OnButton1() 
{
	// TODO: Add your control notification handler code here
	::CoInitialize(NULL); 
_bstr_t bstrSQL;
 UpdateData(true);

	CString strname;
	try
	{
		strname.Format("Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=YPGL;Initial Catalog=YPGL");
		m_pConnection.CreateInstance("ADODB.Connection");
		_bstr_t strConnect=strname;
		m_pConnection->Open(strConnect,"","",adModeUnknown);
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
	}
	bstrSQL="delete from VipUser_info where 会员代号='"+m_VipUserNum+"'";
    m_pRecordset.CreateInstance(__uuidof(Recordset));
	m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
	AfxMessageBox("删除成功!");
	UpdateData(false);
}

⌨️ 快捷键说明

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