CZYXXB.CPP
资源名称:gongzi.rar [点击查看]
上传用户:ghostdhl
上传日期:2018-06-14
资源大小:9728k
文件大小:3k
源码类别:
数据库编程
开发平台:
Visual C++
- // Czyxxb.cpp: implementation of the CCzyxxb class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "GZGLXT.h"
- #include "Czyxxb.h"
- #include "ADOConn.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CCzyxxb::CCzyxxb()
- {
- }
- CCzyxxb::~CCzyxxb()
- {
- }
- CString CCzyxxb::GetCzyName()
- {
- return CzyName;
- }
- void CCzyxxb::SetCzyName(CString cCzyName)
- {
- CzyName=cCzyName;
- }
- CString CCzyxxb::GetPwd()
- {
- return Pwd;
- }
- void CCzyxxb::SetPwd(CString cPwd)
- {
- Pwd=cPwd;
- }
- CString CCzyxxb::GetCzyjb()
- {
- return Czyjb;
- }
- void CCzyxxb::SetCzyjb(CString cCzyjb)
- {
- Czyjb=cCzyjb;
- }
- void CCzyxxb::sql_insert()
- {
- ADOConn m_AdoConn;
- _bstr_t vSQL;
- vSQL="INSERT INTO Czyxxb(CzyName,Pwd,Czyjb)VALUES('"
- +CzyName+"','"+Pwd+"','"+Czyjb+"')";
- m_AdoConn.ExecuteSQL(vSQL);
- m_AdoConn.ExitConnect();
- }
- void CCzyxxb::sql_updatepwd(CString cCzyName)
- {
- ADOConn m_AdoConn;
- _bstr_t vSQL;
- vSQL="UPDATE Czyxxb SET Pwd='"+Pwd+"' WHERE CzyName="+" '"+cCzyName+"'";
- m_AdoConn.ExecuteSQL(vSQL);
- m_AdoConn.ExitConnect();
- }
- void CCzyxxb::sql_delete(CString cCzyName)
- {
- ADOConn m_AdoConn;
- m_AdoConn.OnInitADOConn();
- CString sql;
- sql.Format("delete from Czyxxb where CzyName='%s'",cCzyName);
- m_AdoConn.ExecuteSQL((_bstr_t)sql);
- m_AdoConn.ExitConnect();
- }
- int CCzyxxb::Havename(CString cCzyName)
- {
- ADOConn m_AdoConn;
- m_AdoConn.OnInitADOConn();
- CString sql;
- sql.Format("SELECT*FROM Czyxxb WHERE CzyName='%s'",cCzyName);
- _RecordsetPtr m_pRecordset;
- m_pRecordset=m_AdoConn.GetRecordSet((_bstr_t)sql);
- if(m_pRecordset->adoEOF)
- return -1;
- else
- return 1;
- m_AdoConn.ExitConnect();
- }
- int CCzyxxb::HaveCzy(CString cCzyName,CString cPwd)
- {
- ADOConn m_AdoConn;
- m_AdoConn.OnInitADOConn();
- CString sql;
- sql.Format("SELECT*FROM Czyxxb WHERE CzyName='%s' AND Pwd='%s'",cCzyName,cPwd);
- _RecordsetPtr m_pRecordset;
- m_pRecordset=m_AdoConn.GetRecordSet((_bstr_t)sql);
- if(m_pRecordset->adoEOF)
- return -1;
- else
- return 1;
- m_AdoConn.ExitConnect();
- }
- int CCzyxxb::HaveCzyjb(CString cCzyName,CString cPwd,CString cCzyjb)
- {
- ADOConn m_AdoConn;
- m_AdoConn.OnInitADOConn();
- CString sql;
- sql.Format("SELECT*FROM Czyxxb WHERE CzyName='%s' AND Pwd='%s' AND Czyjb='%s'",cCzyName,cPwd,cCzyjb);
- _RecordsetPtr m_pRecordset;
- m_pRecordset=m_AdoConn.GetRecordSet((_bstr_t)sql);
- if(m_pRecordset->adoEOF)
- return -1;
- else
- return 1;
- m_AdoConn.ExitConnect();
- }