?? borrow.cpp
字號:
// Borrow.cpp: implementation of the CBorrow class.
//
/////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Library.h"
#include "Borrow.h"
#include "ADOConn.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBorrow::CBorrow()
{
Br_BNo = "";
Br_RNo = "";
Br_BrTime = "";
Br_RtTime = "";
Br_MsTime = "";
}
CBorrow::~CBorrow()
{
}
CString CBorrow::GetBookNo()
{
return Br_BNo;
}
CString CBorrow::GetReaderNo()
{
return Br_RNo;
}
CString CBorrow::GetBrTime()
{
return Br_BrTime;
}
CString CBorrow::GetRtTime()
{
return Br_RtTime;
}
void CBorrow::SQL_Update(CString vBNo, CString vRNo)
{
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
_bstr_t vSQL;
vSQL = "UPDATE Borrow SET RtTime='" + Br_RtTime
+"' WHERE BNo='"+vBNo+"' AND RNO='"+vRNo +"'";
m_AdoConn.ExecuteSQL(vSQL);
m_AdoConn.ExitConnect();
}
void CBorrow::SQL_Delete(CString vBNo, CString vRNo)
{
/*//連接數據庫
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//設置DELETE語句
_bstr_t vSQL;
vSQL = "DELETE FROM Borrow WHERE BNo='" + vNo +"'";
//執行DELETE語句
m_AdoConn.ExecuteSQL(vSQL);
//斷開與數據庫的連接
m_AdoConn.ExitConnect();*/
}
void CBorrow::SQL_Insert(CString vBNo, CString vRNo, CString vBrTime, CString vMsTime)
{
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
_bstr_t vSQL;
vSQL = "DELETE FROM Borrow WHERE BNo='" + vBNo +"' AND RNo='" + vRNo + "'";
m_AdoConn.ExecuteSQL(vSQL);
vSQL = "INSERT INTO Borrow VALUES('"+vBNo+"','"+vRNo+"','"+vBrTime+"','"+vMsTime+"','')";
m_AdoConn.ExecuteSQL(vSQL);
m_AdoConn.ExitConnect();
}
void CBorrow::SetBookNo(CString vBNo)
{
Br_BNo = vBNo;
}
void CBorrow::SetReaderNo(CString vRNo)
{
Br_RNo = vRNo;
}
void CBorrow::SetBorrowTime(CString vBrTime)
{
Br_BrTime = vBrTime;
}
void CBorrow::SetReturnTime(CString vRtTime)
{
Br_RtTime = vRtTime;
}
CString CBorrow::GetMsTime()
{
return Br_MsTime;
}
void CBorrow::SetMsTime(CString vMsTime)
{
Br_MsTime = vMsTime;
}
void CBorrow::GetData(CString vBNo)
{
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
_bstr_t vSQL;
vSQL = "SELECT * FROM Borrow WHERE BNo='" + vBNo+"' And RtTime=''";
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
if (m_pRecordset->adoEOF)
CBorrow();
else
{
Br_BNo = vBNo;
Br_RNo = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("RNo");
Br_BrTime = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("BrTime");
Br_MsTime = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("MsTime");
Br_RtTime = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("RtTime");
m_AdoConn.ExitConnect();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -