📄 delarguedlg.cpp
字号:
// DelArgueDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "BankSystem.h"
#include "DelArgueDlg.h"
#include ".\delarguedlg.h"
// DelArgueDlg 对话框
IMPLEMENT_DYNAMIC(DelArgueDlg, CDialog)
DelArgueDlg::DelArgueDlg(CWnd* pParent /*=NULL*/)
: CDialog(DelArgueDlg::IDD, pParent)
{
}
DelArgueDlg::~DelArgueDlg()
{
}
void DelArgueDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, List3);
}
BEGIN_MESSAGE_MAP(DelArgueDlg, CDialog)
ON_WM_SHOWWINDOW()
ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
ON_BN_CLICKED(IDC_Del, OnBnClickedDel)
ON_BN_CLICKED(IDC_Cancel, OnBnClickedCancel)
END_MESSAGE_MAP()
// DelArgueDlg 消息处理程序
void DelArgueDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: 在此处添加消息处理程序代码
CString strQuery="SELECT * FROM argue";
try{
pRst=pConn->Execute(_bstr_t(strQuery),NULL,adCmdText);
}
catch(_com_error &e)
{
MessageBox(e.ErrorMessage());
return ;
}
while(!pRst->rsEOF)//将查询到的数据加到列表框咯。
{
CString str=""+(_bstr_t)pRst->GetCollect("uname")+" "+(_bstr_t)pRst->GetCollect("topic")+" "+(_bstr_t)pRst->GetCollect("content")+"";
List3.AddString(str);
pRst->MoveNext();
}
}
void DelArgueDlg::OnLbnSelchangeList1()
{
// TODO: 在此添加控件通知处理程序代码
}
void DelArgueDlg::OnBnClickedDel()
{
// TODO: 在此添加控件通知处理程序代码
CString strQuery="SELECT * FROM argue";
pRst.CreateInstance("ADODB.Recordset");
pRst->Open(_bstr_t(strQuery),_variant_t((IDispatch*)pConn,true),adOpenStatic,adLockOptimistic,adCmdText);
pRst->MoveFirst();
int index=List3.GetCurSel();
//index--;
while(index)
{
pRst->MoveNext();
index--;
}
try
{
pRst->Delete(adAffectCurrent);
pRst->Update();
}
catch(_com_error &e)
{
MessageBox(e.ErrorMessage());
return ;
}
AfxMessageBox("投诉撤销成功");
index=List3.GetCount();
while(index>=0)
{
List3.DeleteString(index);
index--;
}
//刷新列表
strQuery="SELECT * FROM argue";
try{
pRst=pConn->Execute(_bstr_t(strQuery),NULL,adCmdText);
}
catch(_com_error &e)
{
MessageBox(e.ErrorMessage());
return ;
}
while(!pRst->rsEOF)//将查询到的数据加到列表框咯。
{
CString str=""+(_bstr_t)pRst->GetCollect("uname")+" "+(_bstr_t)pRst->GetCollect("topic")+" "+(_bstr_t)pRst->GetCollect("content")+"";
List3.AddString(str);
pRst->MoveNext();
}
}
void DelArgueDlg::OnBnClickedCancel()
{
// TODO: 在此添加控件通知处理程序代码
OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -