📄 w2faccess.cpp
字号:
// W2FAccess.cpp: implementation of the W2FAccess class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "W2FAccess.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
W2FAccess::W2FAccess()
{
m_strStation="";
m_dblWaterVal=0;
m_dblFlowVal=0;
m_strMemo="";
}
W2FAccess::~W2FAccess()
{
}
int W2FAccess::setvalue()
{
VARIANT varValue;
CString strValue;
try{
varValue.vt=VT_BSTR;
varValue.bstrVal=(_bstr_t)m_strStation;
m_pRst->PutCollect("Station",&varValue);
varValue.vt=VT_R8;
varValue.dblVal=m_dblWaterVal;
m_pRst->PutCollect("WaterVal",&varValue);
varValue.vt=VT_R8;
varValue.dblVal=m_dblFlowVal;
m_pRst->PutCollect("FlowVal",&varValue);
varValue.vt=VT_BSTR;
varValue.bstrVal=(_bstr_t)m_strMemo;
m_pRst->PutCollect("Memo",&varValue);
}
catch(_com_error e){
return -1;
}
return 0;
}
int W2FAccess::bindvalue()
{
if(m_pRst->EndOfFile)return 1;
VARIANT varValue;
CString strValue;
try{
varValue = m_pRst->GetCollect("Station");
if(varValue.vt != VT_NULL)m_strStation=(LPCSTR)_bstr_t(varValue);
varValue = m_pRst->GetCollect("WaterVal");
if(varValue.vt != VT_NULL)m_dblWaterVal=varValue.dblVal;
varValue = m_pRst->GetCollect("FlowVal");
if(varValue.vt != VT_NULL)m_dblFlowVal=varValue.dblVal;
varValue = m_pRst->GetCollect("Memo");
if(varValue.vt != VT_NULL)m_strMemo=(LPCSTR)_bstr_t(varValue);
}
catch(_com_error e){
return -1;
}
return 0;
}
int W2FAccess::watertoflow()
{
int intReturnCode=0;
m_strSQL.Format("select * from W2F%s where station='%s' and WaterVal=%f",m_strStation,m_strStation,m_dblWaterVal);
try{
m_pCmd->ActiveConnection=m_pCon;
m_pCmd->CommandText=(_bstr_t)m_strSQL;
m_pRst=m_pCmd->Execute(NULL,NULL,adCmdText);
m_fConnected=true;
}
catch(_com_error e){
m_strErrMsg.Format("***错误:打开记录集出错:%s",e.ErrorMessage());
return -1;
}
intReturnCode=bindvalue();
if(intReturnCode<0)m_strErrMsg="***错误:获取表栏位值出错";
//m_pRst->Close();
return intReturnCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -