【VC开源代码栏目提醒】:网学会员,鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“Discard.cpp”一文,供大家参考学习!
// Discard.cpp: implementation of the CDiscard class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "AssetsMan.h"
#include "Discard.h"
#include "ADOConn.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDiscard::CDiscard()
{
Aid = "";
DSum = 0;
Reason = "";
CreateDate = "";
EmpName = "";
Checker = "";
CheckDate = "";
Status = "";
}
CDiscard::~CDiscard()
{
}
void CDiscard::sql_Insert()
{
try
{
//连接数据库
ADOConn m_AdoConn;
_bstr_t bSQL;
CString cDSum;
cDSum.Format("%f", DSum);
bSQL = "Insert Into Discard Values('" + Aid + "'," + cDSum
+ ",'" + Reason + "','" + CreateDate + "','" + EmpName
+ "','','','申请')";
m_AdoConn.ExecuteSQL(bSQL);
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 捕捉异常
catch(_com_error e)
{
// 显示错误信息
AfxMessageBox(e.Description());
}
}
// 更新审批意见
void CDiscard::sql_UpdateApproval(CString cId)
{
try
{
//连接数据库
ADOConn m_AdoConn;
_bstr_t bSQL;
bSQL = "UPDATE Discard SET Checker='" + Checker + "', CheckDate='"
+ CheckDate + "', Status='报废' WHERE Aid='" + cId + "'";
m_AdoConn.ExecuteSQL(bSQL);
// 更新表Assets中的状态字段
bSQL = "UPDATE Assets SET Status='报废' WHERE Aid='" + cId + "'";
m_AdoConn.ExecuteSQL(bSQL);
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 捕捉异常
catch(_com_error e)
{
// 显示错误信息
AfxMessageBox(e.Description());
}
}
上一篇:
DisableRegToolDlg.cpp
下一篇:
法学专业毕业论文讲座