?? userchannel.cpp
字號:
// UserChannel.cpp: implementation of the CUserChannel class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "UserChannel.h"
#include "ADOConn.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CUserChannel::CUserChannel()
{
}
CUserChannel::~CUserChannel()
{
}
int CUserChannel::GetUID()
{
return UID;
}
int CUserChannel::GetUserID()
{
return UserID;
}
int CUserChannel::GetChannelID()
{
return ChannelID;
}
int CUserChannel::GetColumnID()
{
return ColumnID;
}
void CUserChannel::SetUID(int iUID)
{
UID=iUID;
}
void CUserChannel::SetUserID(int iUserID)
{
UserID=iUserID;
}
void CUserChannel::SetChannelID(int iChannelID)
{
ChannelID=iChannelID;
}
void CUserChannel::SetColumnID(int iColumnID)
{
ColumnID=iColumnID;
}
void CUserChannel::sql_insert(int iUserID,int iChannelID,int iColumnID)
{
CString strUserID,strChannelID,strColumnID;
strUserID.Format("%d", iUserID);
strChannelID.Format("%d", iChannelID);
strColumnID.Format("%d", iColumnID);
//設置INSERT語句
vSQL = "INSERT INTO UserChannel VALUES(" + strUserID + "," + strChannelID + "," +strColumnID + ")";
AfxMessageBox(vSQL);
//執行INSERT語句
ExecuteSQL(vSQL);
}
void CUserChannel::sql_update(int iUID,int iUserID,int iChannelID,int iColumnID)
{
CString strUID,strUserID,strChannelID,strColumnID;
strUID.Format("%d", iUID);
strUserID.Format("%d", iUserID);
strChannelID.Format("%d", iChannelID);
strColumnID.Format("%d", iColumnID);
//設置UPDATE語句
vSQL = "UPDATE UserChannel SET UserID=" + strUserID + ", ChannelID=" + strChannelID + ", ColumnID=" +strColumnID + " WHERE UID= "+ strUID ;
AfxMessageBox(vSQL);
//執行INSERT語句
ExecuteSQL(vSQL);
}
void CUserChannel::sql_delete(int iUID)
{
CString strUID;
strUID.Format("%d", iUID);
//設置DELETE語句
vSQL = "DELETE FROM UserChannel WHERE UID= "+ strUID ;
AfxMessageBox(vSQL);
//執行INSERT語句
ExecuteSQL(vSQL);
}
void CUserChannel::GetData(int UID)
{
//設置SELECT語句
vSQL = "SELECT * FROM UserChannel WHERE UID=" + UID;
//執行SELETE語句
m_pRecordset = GetRecordSet(vSQL);
//返回各列的值
if (m_pRecordset->adoEOF)
CUserChannel();
else
{
UserID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("UserID"));
ChannelID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ChannelID"));
ColumnID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ColumnID"));
}
}
int CUserChannel::GetAuditor(int iChannelID,int iColumnID)
{
CString strChannelID;
strChannelID.Format("%d",iChannelID);
CString strColumnID;
strColumnID.Format("%d",iColumnID);
//設置SELECT語句
vSQL = "SELECT UserID FROM UserChannel WHERE ChannelID=" + strChannelID+ " AND ColumnID=" + strColumnID;
//執行SELETE語句
m_pRecordset = GetRecordSet(vSQL);
UserID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("UserID"));
return UserID;
}
int CUserChannel::GetColumnIDByUserID(int iUserID)
{
CString strUserID;
strUserID.Format("%d",iUserID);
//設置SELECT語句
vSQL = "SELECT ColumnID FROM UserChannel WHERE IsDelete=0 AND UserID=" + strUserID;
//執行SELETE語句
m_pRecordset = GetRecordSet(vSQL);
ColumnID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ColumnID"));
return ColumnID;
}
//PASS
int CUserChannel::GetChannelIDByUserID(int iUserID)
{
CString strUserID;
strUserID.Format("%d",iUserID);
//設置SELECT語句
vSQL = "SELECT ChannelID FROM UserChannel WHERE IsDelete=0 AND UserID=" + strUserID;
//執行SELETE語句
m_pRecordset = GetRecordSet(vSQL);
ChannelID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ChannelID"));
return ChannelID;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -