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

📄 confirmroutelistdeldlg.cpp

📁 VC++6.0基于CAN协议的车辆控制
💻 CPP
字号:
// ConfirmRouteListDelDlg.cpp : implementation file
//

#include "stdafx.h"
#include "PROJECTPMU.h"
#include "ConfirmRouteListDelDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CConfirmRouteListDelDlg dialog


CConfirmRouteListDelDlg::CConfirmRouteListDelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CConfirmRouteListDelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CConfirmRouteListDelDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CConfirmRouteListDelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfirmRouteListDelDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConfirmRouteListDelDlg, CDialog)
	//{{AFX_MSG_MAP(CConfirmRouteListDelDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnConfirmButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConfirmRouteListDelDlg message handlers

BOOL CConfirmRouteListDelDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//得到应用程序所在文件夹路径
	CAdoRecordSet pRS;
    if(NULL != GetModuleFileName(NULL,mDir_Path,256))  
    {		
		int n=strlen(mDir_Path);
		for (int i=n; i>=0; i--)
		{
			if   (mDir_Path[i]   ==   '\\')   
			{   
				mDir_Path[i]   =   '\0';   
				break;   
			}   
		}
		strcpy(mMDB_Path,mDir_Path);
		strcat(mMDB_Path,"\\PIS.mdb"); // 数据库路径
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CConfirmRouteListDelDlg::OnConfirmButton() 
{
	// TODO: Add your control notification handler code here
	CString str1,str2,sqldelete;
	str1=TrainCode;
	str2=OriginalStationEn;
//	AfxMessageBox(TrainCode);
	str1.TrimLeft();
    str1.TrimRight();
    str2.TrimLeft();
    str2.TrimRight();
	if(m_pConnection.ConnectAccess(mMDB_Path,"sri"))
	sqldelete.Format("delete from RouteList where (TrainCode='%s') and (OriginalStationEn='%s')",str1,str2);
//	AfxMessageBox(sqldelete);
	m_pConnection.Execute(sqldelete);
		Sleep(500);//延时,等数据库更改后再执行下面语句
	CConfirmRouteListDelDlg::OnOK();//将修改后的数据保存到上一个窗体中的控件中
}

⌨️ 快捷键说明

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