eightteen_dialog.cpp
来自「对医院的药品进行管理」· C++ 代码 · 共 87 行
CPP
87 行
// eightteen_dialog.cpp : implementation file
//
#include "stdafx.h"
#include "医药管理系统.h"
#include "eightteen_dialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// eightteen_dialog dialog
eightteen_dialog::eightteen_dialog(CWnd* pParent /*=NULL*/)
: CDialog(eightteen_dialog::IDD, pParent)
{
//{{AFX_DATA_INIT(eightteen_dialog)
m_VipUserNum = _T("");
m_VipUserName = _T("");
m_VipUserSex = _T("");
m_VipUserCardNum = _T("");
m_VipUserTel = _T("");
m_VipUserBankNum = _T("");
//}}AFX_DATA_INIT
}
void eightteen_dialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(eightteen_dialog)
DDX_Text(pDX, IDC_EDIT1, m_VipUserNum);
DDX_Text(pDX, IDC_EDIT2, m_VipUserName);
DDX_Text(pDX, IDC_EDIT3, m_VipUserSex);
DDX_Text(pDX, IDC_EDIT4, m_VipUserCardNum);
DDX_Text(pDX, IDC_EDIT5, m_VipUserTel);
DDX_Text(pDX, IDC_EDIT6, m_VipUserBankNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(eightteen_dialog, CDialog)
//{{AFX_MSG_MAP(eightteen_dialog)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// eightteen_dialog message handlers
void eightteen_dialog::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void eightteen_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="insert into VipUser_info values ('"+m_VipUserNum+"','"+m_VipUserName+"','"+m_VipUserSex+"','"+m_VipUserCardNum+"','"+m_VipUserTel+"','"+m_VipUserBankNum+"')";
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 + -
显示快捷键?