DlgChaoShiBase.cpp
上传用户:jzscgs158
上传日期:2022-05-25
资源大小:8709k
文件大小:3k
- // DlgChaoShiBase.cpp : implementation file
- //
- #include "stdafx.h"
- #include "NCShop.h"
- #include "DlgChaoShiBase.h"
- #include "ADOConn.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgChaoShiBase dialog
- CDlgChaoShiBase::CDlgChaoShiBase(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgChaoShiBase::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgChaoShiBase)
- m_str1 = _T("");
- m_str2 = _T("");
- m_str3 = _T("");
- m_str4 = _T("");
- m_int = -1;
- //}}AFX_DATA_INIT
- }
- void CDlgChaoShiBase::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgChaoShiBase)
- DDX_Control(pDX, IDCANCEL, m_Btn2);
- DDX_Control(pDX, IDOK, m_Btn1);
- DDX_Text(pDX, IDC_EDIT1, m_str1);
- DDV_MaxChars(pDX, m_str1, 50);
- DDX_Text(pDX, IDC_EDIT2, m_str2);
- DDV_MaxChars(pDX, m_str2, 20);
- DDX_Text(pDX, IDC_EDIT3, m_str3);
- DDV_MaxChars(pDX, m_str3, 255);
- DDX_Text(pDX, IDC_EDIT4, m_str4);
- DDV_MaxChars(pDX, m_str4, 255);
- DDX_CBIndex(pDX, IDC_COMBO1, m_int);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgChaoShiBase, CDialog)
- //{{AFX_MSG_MAP(CDlgChaoShiBase)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgChaoShiBase message handlers
- BOOL CDlgChaoShiBase::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- CADOConn adoMain;
- CString strSql;
- GetDlgItem(IDC_STATIC1)->SetFont(&ftHeader,TRUE);
- m_Btn1.SetXIcon(IDI_ICONBUTTON);
- m_Btn2.SetXIcon(IDI_ICONBUTTON);
- strSql="select * from 超市基本信息表";
- adoMain.Open(strSql);
- if(!adoMain.adoEOF())
- {
- if(adoMain.MoveFirst())
- {
- m_str1=adoMain.GetValueString(1,1);
- m_str2=adoMain.GetValueString(3,1);
- m_str3=adoMain.GetValueString(4,1);
- m_str4=adoMain.GetValueString(5,1);
- m_int=adoMain.GetValueInt(2);
- UpdateData(FALSE);
- }
- }
- adoMain.ExitConnect();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CDlgChaoShiBase::OnOK()
- {
- // TODO: Add extra validation here
- CADOConn adoMain;
- CString strSql;
- CString str;
- UpdateData(TRUE);
- if(m_str1=="")
- {
- MessageBox("超市名字不能为空!","提示",MB_OK|MB_ICONWARNING);
- GetDlgItem(IDC_EDIT1)->SetFocus();
- return;
- }
- str.Format("%d",m_int);
- strSql="update 超市基本信息表 set 名称='";
- strSql=strSql+m_str1+"',性质=";
- strSql=strSql+str+",联系方式='";
- strSql=strSql+m_str2+"',地址='";
- strSql=strSql+m_str3+"',备注='";
- strSql=strSql+m_str4+"' where 编号=1";
- adoMain.ExecuteSQL(strSql);
- adoMain.ExitConnect();
- CDialog::OnOK();
- }