本文整理汇总了C++中_RecordsetPtr类的典型用法代码示例。如果您正苦于以下问题:C++ _RecordsetPtr类的具体用法?C++ _RecordsetPtr怎么用?C++ _RecordsetPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_RecordsetPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OnShowGrid
void CDlg::OnShowGrid(CString strSql,_RecordsetPtr& rs,_CommandPtr& Cmd,CDatagrid1& Grd,void (*pFGrd)(CDatagrid1&,_RecordsetPtr&))
{
if(!strSql.IsEmpty()) {
Cmd->CommandText = (_bstr_t)strSql;
try {
Grd.putref_DataSource(NULL);
if(rs->State==adStateOpen) rs->Close();
rs->Open(m_vNULL,m_vNULL,adOpenDynamic,adLockOptimistic,adCmdText);
m_Flg = false;
// m_Flg = true;
//AfxMessageBox(L"Before OnShow Grd.putref_DataSource((LPUNKNOWN)rs)");
Grd.putref_DataSource((LPUNKNOWN)rs);
//AfxMessageBox(L"After OnShow Grd.putref_DataSource((LPUNKNOWN)rs)");
// m_Flg = false;
/*----*/// m_Flg = true;
m_CurCol = Grd.get_Col();
// s.Format("%i",m_CurCol);
// AfxMessageBox(s);
if(m_CurCol==-1 || m_CurCol==0 ) {
m_CurCol = 1;
}
m_iCurType = GetTypeCol(rs,m_CurCol);
pFGrd(Grd,rs);
}
catch(_com_error& e) {
Grd.putref_DataSource(NULL);
AfxMessageBox(e.ErrorMessage());
}
}
}
开发者ID:03bekjob,项目名称:Strg,代码行数:30,代码来源:Dlg.cpp
示例2: GetRecordCount
UINT CBADO::GetRecordCount( _RecordsetPtr pRecordset )
{
int nCount = 0;
try
{
if(pRecordset->EndOfFile)
{
Sleep(1);
return 0;
}
pRecordset->MoveFirst();
}
catch(...)
{
return 0;
}
if (pRecordset->FirstOfFile)
return 0;
while(!pRecordset->EndOfFile)
{
pRecordset->MoveNext();
nCount = nCount + 1;
}
pRecordset->MoveFirst();
return nCount;
}
开发者ID:Fance,项目名称:T3000_Building_Automation_System,代码行数:29,代码来源:BADO.cpp
示例3: RecNo
///////////////////////////////////////////////
//
//返回当前记录集的游标位置
//
//IRecordset[in] 记录集智能指针
//
//函数成功返回当前记录集的游标位置,否则返回-1
//
long CFoxBase::RecNo(_RecordsetPtr IRecordset)
{
long pos=0;
long i;
if(IRecordset==NULL)
return -1;
if(IRecordset->adoEOF && IRecordset->BOF)
return -1;
while(!IRecordset->GetBOF())
{
pos++;
IRecordset->MovePrevious();
}
i=pos;
i--;
IRecordset->MoveFirst();
while(i>0)
{
i--;
IRecordset->MoveNext();
}
return pos;
}
开发者ID:uesoft,项目名称:AutoIPED,代码行数:38,代码来源:FoxBase.cpp
示例4: GetDataStr
CString CADODB::GetDataStr(_RecordsetPtr pRecordset)
{
if (NULL == pRecordset) return _T("");
CString strData;
int nFieldsCount = pRecordset->Fields->GetCount(); // 字段数;
for (int i = 0; i < nFieldsCount; i++)
{
char *pszName = _com_util::ConvertBSTRToString(pRecordset->Fields->GetItem((long)i)->GetName()); // 字段名
strData += pszName;
strData += _T("\t");
delete[] pszName;
}
strData += _T("\n");
while (!pRecordset->EndOfFile) //遍历所有记录
{
for (int i = 0; i < nFieldsCount; i++)
{
strData += pRecordset->GetCollect((long)i);
strData += _T("\t");
}
strData += _T("\n");
pRecordset->MoveNext();
}
return strData;
}
开发者ID:tempbottle,项目名称:TestSet,代码行数:32,代码来源:ADODB.cpp
示例5: switch
void CDlg::InitDataGrid1(CDatagrid1& Grd,_RecordsetPtr& rs)
{
CColumns GrdClms;
CString strCap,strRec;
CString s;
long num,numRec;
short i;
float wdth;
strCap.LoadString(IDS_STRING9013);
numRec = 0;
GrdClms.AttachDispatch(Grd.get_Columns());
if(rs->State==adStateOpen) {
num = rs->GetadoFields()->GetCount();
numRec = rs->GetRecordCount();
strRec.Format(_T(" %i"),numRec);
strCap +=strRec;
Grd.put_Caption(strCap);
for (i=0; i<num; i++) {
switch(i) {
case 0:
GrdClms.GetItem((COleVariant) i).SetVisible(FALSE);
break;
case 1:
wdth = 75;
GrdClms.GetItem((COleVariant) i).SetWidth(wdth);
break;
case 2:
wdth = 190;
GrdClms.GetItem((COleVariant) i).SetWidth(wdth);
break;
case 3:
wdth = 48;
GrdClms.GetItem((COleVariant) i).SetWidth(wdth);
break;
case 4:
wdth = 185;
GrdClms.GetItem((COleVariant) i).SetWidth(wdth);
break;
case 5:
wdth = 100;
GrdClms.GetItem((COleVariant) i).SetWidth(wdth);
break;
default:
GrdClms.GetItem((COleVariant) i).SetVisible(FALSE);
break;
}
}
}
else {
strRec.Format(_T(" %i"),numRec);
strCap +=strRec;
Grd.put_Caption(strCap);
}
}
开发者ID:03bekjob,项目名称:Strg,代码行数:58,代码来源:Dlg.cpp
示例6: create_rs
void HiDBOracle::create_rs(const char* name, const char* sql, _RecordsetPtr& rs)
{
::CoInitialize(NULL);
HRESULT hr = rs.CreateInstance(__uuidof(Recordset));
if (FAILED(hr))
{
_com_error e(hr);
on_excetion("HiDBOracle::ExecuteScalar", sql, e);
}
rs->PutCursorLocation(adUseClient);
}
开发者ID:xumingxsh,项目名称:HiDB,代码行数:11,代码来源:HiDBOracle.cpp
示例7: ADORecordsetOpen
int CCommDBOper::ADORecordsetOpen(_ConnectionPtr &pCon,_RecordsetPtr pRs,CString strOpenSql,CString strDcrOpen,int iWarn)
{
//函数说明:执行指定记录集对象指定SQL操作
//pCon 数据库连接对象
//pRs 当前操作用记录集对象
//strOpenSql 要执行的SQL命令
//strDcrOpen是对要使用SQL命令的描述
_variant_t tempStrSql;
tempStrSql = strOpenSql;
if (pRs == NULL)
{
pRs.CreateInstance(__uuidof(Recordset));
pRs->CursorLocation = adUseClient;
}
ADOCloseRecordset(pRs,0);
while (true)
{
try
{
//有错 pRs->Open(tempStrSql,_variant_t(pCon),adOpenDynamic,adLockOptimistic,adCmdText);
pRs->Open(tempStrSql,(IDispatch *)pCon,adOpenDynamic,adLockOptimistic,adCmdText);
break;
}
catch (_com_error &e)
{
CString strMsg;
strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
AfxMessageBox(strMsg);
}
try
{
//如果第一次打开失败,看能否以只读方式打开
pRs->Open(tempStrSql,(IDispatch *)pCon,adOpenDynamic,adLockReadOnly,adCmdText);
return 2;
}
catch (_com_error &e)
{
CString strMsg;
strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
AfxMessageBox(strMsg);
CString errormessage;
errormessage.Format("功能说明: %s\r\n记录集对象执行下列SQL命令\r\n%s\r\n失败! 错误信息:%s",strDcrOpen,strOpenSql,e.ErrorMessage());
WarnMessage(errormessage,iWarn);//显示错误信息
return RET_FAILED;
}
}
return RET_OK;
}
开发者ID:uesoft,项目名称:AutoPHS,代码行数:52,代码来源:CommDBOper.cpp
示例8: ReplAll
///////////////////////////////////////////////////////////
//
//替换记录集中选中字段所有的值
//
//IRecordset[in] 记录集智能指针
//FieldsName[in] 字段名
//Value[in] 输入替换FieldsName字段的值
//
//函数成功返回TRUE,否则返回FALSE
//当函数成功返回时,当前游标指针指向记录集最后一个记录的后面
//
BOOL CFoxBase::ReplAll(_RecordsetPtr IRecordset, _variant_t FieldsName, _variant_t Value)
{
if(IRecordset==NULL)
return FALSE;
IRecordset->MoveFirst();
while(!IRecordset->adoEOF)
{
IRecordset->PutCollect(FieldsName,Value);
IRecordset->Update();
IRecordset->MoveNext();
}
return TRUE;
}
开发者ID:uesoft,项目名称:AutoIPED,代码行数:26,代码来源:FoxBase.cpp
示例9: PutTbValue
/////////////////////////////////////////////////////////////////////////////////////////
//
// 在记录集中当前游标位置设置指定的字段的值
//
// IRecordset[in] 记录集智能指针
// FieldsName[in] 字段名
// Value[in] 新的值
//
// 如果有异常将调用ExceptionInfo函数
//
void CFoxBase::PutTbValue(_RecordsetPtr IRecordset, _variant_t FieldsName, double Value)
{
if(IRecordset==NULL)
return;
try
{
IRecordset->PutCollect(FieldsName,_variant_t(Value));
IRecordset->Update();
}
catch(_com_error /*&e*/)
{
// ExceptionInfo(e);
throw;
}
}
开发者ID:uesoft,项目名称:AutoIPED,代码行数:26,代码来源:FoxBase.cpp
示例10: GetRecordset
_RecordsetPtr& GetRecordset(_bstr_t SQL)
{
m_pRecordset=NULL;
try{
if(m_pConnection==NULL)
//连接
Connect();
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->Open((_bstr_t)SQL, m_pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);
}
catch(_com_error e){
cout<<e.Description()<<endl;
m_pRecordset=NULL;
return m_pRecordset;
}
return m_pRecordset;
}
开发者ID:mz247,项目名称:C-C-,代码行数:17,代码来源:adoConnectSQL.cpp
示例11: switch
__int64
ADOConnection::_GetIdentityFromRS(_RecordsetPtr pRS) const
{
try
{
if (pRS->GetRecordCount() == 0)
return 0;
_variant_t vaField;
FieldsPtr pFields;
FieldPtr pField;
HRESULT hr;
hr = pRS->get_Fields( &pFields );
vaField = "IDENT";
pFields->get_Item( vaField, &pField );
vaField.Clear();
if (pField)
{
pField->get_Value(&vaField);
switch (vaField.vt)
{
case VT_NULL:
return 0;
case VT_I4:
return vaField.intVal;
default:
if (vaField.decVal.sign == DECIMAL_NEG)
return -vaField.cyVal.int64;
else
return vaField.cyVal.int64;
}
}
return 0;
}
catch (...)
{
ErrorManager::Instance()->ReportError(ErrorManager::High, 5030, "ADOConnection::_GetIdentityFromRS", "Error while determening @@IDENTITY");
}
return 0;
}
开发者ID:jrallo,项目名称:hMailServer,代码行数:45,代码来源:ADOConnection.cpp
示例12: UnitsToUeUnits
//单位换算
//SourceUnits 被转换的单位
//UeUnits 转换后的单位
//返回单位换算因子
//dOffset 偏移值
double CAESARIIToPHS::UnitsToUeUnits(_RecordsetPtr rsData,CString SourceUnits,CString UeUnits,double &dOffset)
{
double x;//单位换算因子
CString strSQL;
_RecordsetPtr pRs;
_ConnectionPtr pCon;
pCon.CreateInstance(__uuidof(Connection));
pRs.CreateInstance(__uuidof(Recordset));
strSQL="select * from UnitsToUeUnits ";//删除了pfg20050629where Units='"+SourceUnits+"' and UeUnits='"+UeUnits+"'
try
{
pCon=rsData->GetActiveConnection();
pRs->Open(_variant_t(strSQL),(IDispatch*)pCon,adOpenStatic,adLockOptimistic,adCmdText);
pRs->Filter=_variant_t("Units='"+SourceUnits+"' and UeUnits='"+UeUnits+"'");//pfg20050629
if(pRs->GetRecordCount()>0)
{
x=vtof(pRs->GetCollect(_T("value")));
dOffset=vtof(pRs->GetCollect(_T("offset")));//pfg20050701
return x;
}
else if(pRs->GetRecordCount()==0)
{
//pfg20050629弹出增加单位转换关系对话框(statr)
CUnitsTransformDlg dlg;
pRs->Filter="";
dlg.m_pRsUnits=pRs;
dlg.m_strDestinationUnits=UeUnits;
dlg.m_strSourceUnits=SourceUnits;
if((dlg.DoModal())==IDOK)
{
pRs=dlg.m_pRsUnits;//pfg20050630
pRs->Filter=_variant_t("Units='"+SourceUnits+"' and UeUnits='"+UeUnits+"'");//pfg20050629
if(pRs->GetRecordCount()>0)
{
dOffset=vtof(pRs->GetCollect("Offset"));//pfg20050701
x=vtof(pRs->GetCollect(_T("value")));
return x;
}
else
return 1.0;
}
else
{
m_IsCaesarError=TRUE;//增加了一个条件pfg20050627
}
//pfg20050629弹出增加单位转换关系对话框(end)
}
}
catch(_com_error &e)
{
if(AfxMessageBox("错误:当前单位不能转换,请更换单位后重试(仔细阅读使用说明)!",MB_YESNO)==IDYES)
{
m_IsCaesarError=TRUE;//增加了一个条件pfg20050627
}
}
return 1.0;
}
开发者ID:uesoft,项目名称:AutoPHS,代码行数:62,代码来源:CAESARIIToPHS.cpp
示例13: OpenQuery
DWORD CNHSQLServerDBO::OpenQuery(const _ConnectionPtr &pConnection, _RecordsetPtr &pRecordset, const wchar_t *const pwchSQL)
{
assert(NULL != pConnection);
assert(NULL != pwchSQL);
DWORD dwReturn(0x00);
try
{
pRecordset.CreateInstance(L"ADODB.Recordset");
pRecordset->Open((_bstr_t)pwchSQL,
_variant_t((IDispatch*)pConnection, true),
adOpenStatic,
adLockOptimistic,
adCmdText);
}
catch (_com_error &e)
{
//#ifdef _DEBUG
const int nErrMsgLength(MAX_PATH);
wchar_t *pwchErrMsg = new wchar_t[nErrMsgLength]();
_snwprintf_s(pwchErrMsg, nErrMsgLength, _TRUNCATE, L"CNHSQLServerDBO::OpenQuery发生错误(执行%s)。", pwchSQL);
// 输出错误信息到输出窗口
OutputDebugStringW(L"\t");
OutputDebugStringW(pwchErrMsg);
OutputDebugStringW(L"\n");
// 输出错误信息到日志文件
if (0 != wcscmp(m_wchLogFilePath, L""))
{
// 当日志文件路径不为空时,写日志
CNHLogAPI::WriteLogEx(m_wchLogFilePath, LOG_ERR, L"NHSQLServerDBO", pwchErrMsg);
}
if (NULL != pwchErrMsg)
{
delete[] pwchErrMsg;
pwchErrMsg = NULL;
}
OutputDBErrMsg(e);
//#endif
dwReturn = 0x01;
}
return dwReturn;
}
开发者ID:musclecui,项目名称:Solution1,代码行数:44,代码来源:NHSQLServerDBO.cpp
示例14: ReplNext
///////////////////////////////////////////////////////////
//
//替换从记录集中选中字段指定条记录的值(相当于FOXPRO中 Replace Next)
//
//IRecordset[in] 记录集智能指针
//FieldsName[in] 字段名
//Value[in] 输入替换FieldsName字段的值
//num[in] 需替换的记录数
//
//函数成功返回TRUE,否则返回FALSE
//函数从当前游标位置开始替换
//当函数成功返回时,当前游标指针指向最后修改的记录集上
//当需替换的记录数超过最后一条记录时,游标指向最后一条记录的后面
//
BOOL CFoxBase::ReplNext(_RecordsetPtr IRecordset, _variant_t FieldsName, _variant_t Value, int num)
{
if(IRecordset==NULL || num<=0)
return FALSE;
while(!IRecordset->adoEOF)
{
IRecordset->PutCollect(FieldsName,Value);
IRecordset->Update();
num--;
if(num<=0)
break;
IRecordset->MoveNext();
}
return TRUE;
}
开发者ID:uesoft,项目名称:AutoIPED,代码行数:33,代码来源:FoxBase.cpp
示例15: QuerySQL
LRESULT DBConnect::QuerySQL(LPCSTR bstrSQL, _RecordsetPtr& pRecordset, CursorTypeEnum cursorType, LockTypeEnum lockType)
{
if (!m_bDBOpen||m_pAdoConn->GetState()!=ADODB::adStateOpen)
{
return -1;
}
try
{
pRecordset.CreateInstance(__uuidof(Recordset));
pRecordset->Open((_bstr_t)bstrSQL, m_pAdoConn.GetInterfacePtr(), cursorType /*adOpenStatic*/ /*adOpenDynamic*/, lockType/*adLockOptimistic*/, adCmdText);
}
catch(_com_error e)
{
MessageBox(NULL,e.Description(),_T("提示") ,1);
throw e;
}
return 0;
}
开发者ID:zhangcs3,项目名称:WeighingManager,代码行数:19,代码来源:DBConnPool.cpp
示例16: LoadFrom
BOOL CPagerChannel::LoadFrom(_RecordsetPtr xRecordset)
{
m_pRecordset = xRecordset->Clone( adLockOptimistic );
m_pRecordset->Filter = "xjsjbh = " + (_bstr_t)xRecordset->GetCollect("xjsjbh");
//_variant_t xjsjbh = m_pRecordset->GetCollect( "xjsjbh" );
// theApp.Message(MSG_ERROR,"---------->debug:[%i][%i] reccc=%i", m_nChan, xjsjbh.lVal,
// m_pRecordset->GetRecordCount());
CDialPacket* pPacket = new CDialPacket;
pPacket->SetLocalId( "96031222" );
_variant_t TheValue = m_pRecordset->GetCollect( "xPhoneNum" );
if ( VT_NULL == TheValue.vt ) pPacket->SetRemoteId( "" );
else pPacket->SetRemoteId( (LPCTSTR)(_bstr_t)TheValue );
TheValue = m_pRecordset->GetCollect( "xCaller" );
if ( VT_NULL == TheValue.vt ) pPacket->SetFeeNumber( "" );
else pPacket->SetFeeNumber( (LPCTSTR)(_bstr_t)TheValue );
CHAR xCallerId[MAX_PHONE + 1]; ZeroMemory(xCallerId, MAX_PHONE + 1);
pPacket->GetFeeNumber(xCallerId); pPacket->SetCallerId(xCallerId);
#if 1 // 重新指定计费号码
TheValue = m_pRecordset->GetCollect( "xFeeNumber" );
if ( VT_NULL != TheValue.vt ) pPacket->SetFeeNumber( (LPCTSTR)(_bstr_t)TheValue );
#endif
OnDialPacket( pPacket ); pPacket->Release();
#if 1
TheValue = m_pRecordset->GetCollect( "xPCMName" );
CString xUsrLvFile = (LPCTSTR)(_bstr_t)TheValue;
xUsrLvFile.TrimLeft(); xUsrLvFile.TrimRight();
CString xCallType = ReadPagerType( xUsrLvFile, CA_HOOK );
if ( xCallType.CompareNoCase(CallType) ) CopyMemory( CallType, (LPCTSTR)(xCallType), MAX_CALLTYPE );
//if ( IsMusic(pPager->UsrLvFile) ) CopyMemory( pPager->CallType, "BEST", MAX_CALLTYPE );
#endif
UpdateState( _PENDING_ );
m_bPending = TRUE;
return TRUE;
}
开发者ID:pics860,项目名称:callcenter,代码行数:43,代码来源:ChannelPager.cpp
示例17: GetRecordCount
int RxADO::GetRecordCount(_RecordsetPtr pRst)
{
int nCount=0;
try{
pRst->MoveFirst();
}
catch(...)
{
return 0;
}
if(pRst->_EOF)
return 0;
while (!pRst->_EOF)
{
pRst->MoveNext();
nCount=nCount+1;
}
pRst->MoveFirst();
return nCount;
}
开发者ID:ice98,项目名称:mycode_bak,代码行数:20,代码来源:RxADO.cpp
示例18: OnReadGroup
int CNetworkTree::OnReadGroup(_RecordsetPtr xRecordset, CString& xUserGrp, CString& xGroupId)
{
_variant_t TheValue = xRecordset->GetCollect( "xentercode" );
ASSERT( VT_NULL != TheValue.vt ); xGroupId = (LPCTSTR)(_bstr_t)TheValue;
TheValue = xRecordset->GetCollect( "xentername" );
if ( VT_NULL == TheValue.vt ) xUserGrp = _T("<NULL>");
else xUserGrp = (LPCTSTR)(_bstr_t)TheValue;
TheValue = xRecordset->GetCollect( "xexpiredate" );
if ( VT_NULL != TheValue.vt )
{
COleDateTime tt = TheValue; tt.SetTime( 0, 0, 0 );
COleDateTimeSpan tSpan = COleDateTime::GetCurrentTime() - tt;
if ( tSpan.GetTotalDays() > 0 ) return EBase_NoPay;
}
return 0;
}
开发者ID:pics860,项目名称:callcenter,代码行数:20,代码来源:CtrlNetworkTree.cpp
示例19: GetRecordSet
//Get record of database
bool DataConnection::GetRecordSet(_RecordsetPtr &m_pRecordset , _bstr_t bstrSQL)
//第一个参数是引用类型,也就是传出参数,可看做函数的返回值,第二个参数是SQL语句,是输入。
{
try
{
if(m_pConnection==NULL) //初始化连接
OnInitADOConn();
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pConnection->CursorLocation = adUseClient;
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
return true;
}
catch(_com_error e) //失败
{
MessageBox(NULL,e.Description(),"提示",MB_ICONINFORMATION | MB_OK);
return false;
}
}
开发者ID:hectonpdomingos,项目名称:PenetrationTest,代码行数:22,代码来源:DataConnection.cpp
示例20:
// 打开记录集
_RecordsetPtr& ADOConn::GetRecordSet(_bstr_t bstrSQL)
{
//TODO: insert return statement here
try
{
if (m_pConnection==NULL)
{
OnInitADOConn();
}
//创建记录对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
//取得表中记录
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,
adLockOptimistic,adCmdText);
}
catch (_com_error e)
{
e.Description();
}
return m_pRecordset;
}
开发者ID:owenyang0,项目名称:ADOConn,代码行数:22,代码来源:ADOConn.cpp
注:本文中的_RecordsetPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论