本文整理汇总了C++中_RecordsetPtr::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ _RecordsetPtr::Update方法的具体用法?C++ _RecordsetPtr::Update怎么用?C++ _RecordsetPtr::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_RecordsetPtr
的用法示例。
在下文中一共展示了_RecordsetPtr::Update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportHangerRestraints
//吊架和支架数据的导入pfg20050615
//flag=0 为吊架; flag=1 为支架
//记录集是结果集 对应ZA表
//rsHR记录集是数据源集(弹簧、吊架)
//ltemp 支吊架号
void CAESARIIToPHS::ImportHangerRestraints(_RecordsetPtr rsData,_RecordsetPtr rsHR,long <emp,long &FileNameID,char *strPSAVER,long &node,int flag)
{
_variant_t tmpvar;
long lTmp;
try
{
if(flag)
{
tmpvar=rsHR->GetCollect(_T("node_num"));
lTmp=vtoi(rsHR->GetCollect(_T("RES_TYPEID")));//pfg20050624
}
else
{
tmpvar=rsHR->GetCollect(_T("node"));
}
if(tmpvar.vt==VT_EMPTY||tmpvar.vt==VT_NULL)
{
return;
}
else
{
node=vtoi(tmpvar);
}
if ( node < 1e-6 ) //5.2版本中所有的约束信息会导入INPUT_RESTRAINTS表中(同一约束点会有四条记录,所以会有NODE_NUM为-1情况)
return;
if(rsData->GetRecordCount()>0)
{
rsData->MoveFirst();
}
rsData->Filter = _variant_t(CString("[jsdbh1] = ") + ltos(node)+" AND [FileNameID]="+ltos(FileNameID));
if (rsData->adoEOF&&rsData->BOF)
{
rsData->AddNew();
rsData->PutCollect("VolumeID",_variant_t(EDIBgbl::SelVlmID));
rsData->PutCollect("zdjh",_variant_t((long)(ltemp+1)));
rsData->PutCollect("FileNameID",_variant_t(FileNameID));
ltemp++;
rsData->Update();
}
rsData->PutCollect("PSAver", _variant_t(strPSAVER));
rsData->PutCollect("UPxyz",_variant_t((long)m_iUPxyz));
rsData->PutCollect("JSDBH1", _variant_t((long)node));
rsData->Update();
}
catch (_com_error &e)
{
CString strMsg;
strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
AfxMessageBox(strMsg);
}
}
示例2: ReplaceAreaValue
//替换指定范围的某字段的值.
bool CFoxBase::ReplaceAreaValue(_RecordsetPtr pRs, CString strField, CString strValue, int startRow, int endRow)
{
if(startRow > endRow)
{
endRow = startRow;
}
if( endRow <= 0 )
{
return false;
}
if( endRow > pRs->GetRecordCount() )
{
return false;
}
if( pRs->GetRecordCount() <= 0 )
{
return false;
}
pRs->MoveFirst();
for(int i=1; i<=endRow && !pRs->adoEOF; i++, pRs->MoveNext())
{
if( i >= startRow )
{
pRs->PutCollect(_variant_t(strField), _variant_t(strValue));
pRs->Update();
}
}
return true;
}
示例3: 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;
}
示例4: 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;
}
}
示例5: main
void main()
{
string sql;
_RecordsetPtr m_pRecordset;
sql="select * from testDB";
_bstr_t bstr_t(sql.c_str());
m_pRecordset= GetRecordset(bstr_t);
_variant_t vID;
_variant_t vName;
_variant_t vAge;
while(!m_pRecordset->adoEOF)
{
//取得第1列的值,从0开始计数,你也可以直接给出列的名称,如下一行
vID = m_pRecordset->GetCollect(_variant_t((long)0));
vName = m_pRecordset->GetCollect("Name");
vName = m_pRecordset->GetCollect("Age");
cout<<vID.iVal<<endl;
//cout<<(char*)(_bstr_t)vName<<endl;
//cout<<(LPCTSTR)(_bstr_t)vName<<endl;
cout<<vName.bstrVal<<endl;
cout<<vAge.intVal<<endl;
m_pRecordset->MoveNext();
}
//添加3条新的纪录
for(int i=0;i<3;i++){
m_pRecordset->AddNew();
m_pRecordset->PutCollect("ID", _variant_t("3"));
m_pRecordset->PutCollect("Name", _variant_t("edward"));
m_pRecordset->PutCollect("Age", _variant_t("18"));
}
m_pRecordset->Update();
cout<<"添加成功"<<endl;
//移到首条记录
//m_pRecordset->MoveFirst();
//删除当前记录
//m_pRecordset->Delete(adAffectCurrent);
ExitConnect();
}
示例6: 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;
}
示例7: CopyData
BOOL CFoxBase::CopyData(_RecordsetPtr &IRecordS, _RecordsetPtr &IRecordD)
{
_variant_t TempValue;
short Item;
FieldsPtr IFields;
FieldPtr IField;
if(IRecordS==NULL || IRecordD==NULL)
{
ExceptionInfo(_T("Source Recordset or destination Recordset cann't be empty"));
return FALSE;
}
if(IRecordS->adoEOF && IRecordS->BOF)
{
return TRUE;
}
if(!IRecordD->adoEOF || !IRecordD->BOF)
{
try
{
IRecordD->MoveLast();
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
}
try
{
IRecordS->MoveFirst();
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
try
{
while(!IRecordS->adoEOF)
{
IRecordS->get_Fields(&IFields);
IRecordD->AddNew();
for(Item=0;Item<IFields->GetCount();Item++)
{
IFields->get_Item(_variant_t(Item),&IField);
TempValue=IRecordS->GetCollect(_variant_t(IField->GetName()));
IRecordD->PutCollect(_variant_t(IField->GetName()),TempValue);
IField.Release();
}
IRecordD->Update();
IFields.Release();
IRecordS->MoveNext();
}
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
return TRUE;
}
示例8: InsertNew
/////////////////////////////////////////////////////
//
// 在记录集的当前位置插入一条新记录
//
// IRecord[in] 记录集智能指针
//
// 函数成功返回TRUE,否则返回FALSE
// 如果有异常将调用ExceptionInfo函数
//
// 函数成功后记录集将指向新插入的空记录
//
BOOL CFoxBase::InsertNew(_RecordsetPtr &IRecord,int after)
{
int pos;
CMap<short,short&,_variant_t,_variant_t&> FieldMap;
CMap<short,short&,_variant_t,_variant_t&> newFieldMap; //将新增加的记录的值记下来
_variant_t TempValue;
short Item;
FieldsPtr IFields;
FieldPtr IField;
int pos1;
int nCount; //字段个数.
if(IRecord==NULL)
{
ExceptionInfo(_T("Recordset cann't be empty"));
return FALSE;
}
//如果记录集为空将插入一条新记录
if(IRecord->adoEOF && IRecord->BOF)
{
try
{
IRecord->AddNew();
IRecord->Update();
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
return TRUE;
}
else if(IRecord->adoEOF)
{
IRecord->AddNew();
IRecord->Update();
IRecord->MoveLast();
return true;
}
for(pos=0; !IRecord->adoEOF ;pos++)
{
try
{
IRecord->MoveNext();
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
}
//
// 查如一条新记录,并将刚开始所指的以后的记录向后移
//
try
{
IRecord->AddNew();
IRecord->Update();
IRecord->MoveLast();
//将新增加的记录的值记下来.
IFields = IRecord->GetFields();
nCount = IFields->GetCount(); //字段个数
for (Item = 0; Item < nCount; Item++)
{
newFieldMap[Item] = IRecord->GetCollect(_variant_t(Item));
}
IFields.Release();
//
IRecord->MovePrevious();
}
catch(_com_error &e)
{
ExceptionInfo(e);
return FALSE;
}
if(after==1)
pos--; //使pos再减一,变成在指针的当前位置上加入一条新记录,insert blank
pos1=pos;
while(pos>0)
{
try
{
for(Item=0;Item<nCount;Item++)
//.........这里部分代码省略.........
示例9: SaveSlideData
void CBacilusDetectDoc::SaveSlideData()
{
CString sql;
m_pRs->raw_Close();
sql.Format(_T("select *from BacilusDetect.dbo.PatientPerInfo where SlideID = '%s'"),m_SlideBoxData.SlideInfo.strSlideID);
m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
if(m_pRs->adoEOF)//如果之前没有SlideID信息则
{
try
{
m_pRs->raw_Close();
//病人个人信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientPerInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("Name"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strName;
m_pRs->Fields->GetItem(_variant_t("PatientID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strPatientID;
m_pRs->Fields->GetItem(_variant_t("Department"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strDepartment;
m_pRs->Fields->GetItem(_variant_t("BedID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strBedID;
m_pRs->Fields->GetItem(_variant_t("Gender"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.nGender;
m_pRs->Fields->GetItem(_variant_t("Year"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.nYear;
m_pRs->Fields->GetItem(_variant_t("Occupation"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strOccupation;
m_pRs->Fields->GetItem(_variant_t("Telephone"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strTelephone;
m_pRs->Fields->GetItem(_variant_t("Address"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strAddress;
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
m_pRs->Update();
AfxMessageBox(_T("病人个人信息表保存成功!"));
}
catch(...)
{
AfxMessageBox(_T("病人个人信息表保存失败!"));
}
try
{
m_pRs->raw_Close();
//病人玻片信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientSlideInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
m_pRs->Fields->GetItem(_variant_t("Type"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strType;
_variant_t var;
var.vt=VT_DATE;
var.date=int(m_SlideBoxData.SlideInfo.dtDetectData);
m_pRs->Fields->GetItem(_variant_t("DetectData"))->Value=(_bstr_t)var;
_variant_t vart;
vart.vt=VT_DATE;
vart.date=DATE(m_SlideBoxData.SlideInfo.dtDetectTime);
m_pRs->Fields->GetItem(_variant_t("DetectTime"))->Value=(_bstr_t)vart;
m_pRs->Fields->GetItem(_variant_t("Quantity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strQuantity;
m_pRs->Fields->GetItem(_variant_t("StayTime"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strStayTime;
m_pRs->Fields->GetItem(_variant_t("Method"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strMethod;
m_pRs->Fields->GetItem(_variant_t("SendDoctor"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSendDoctor;
m_pRs->Fields->GetItem(_variant_t("Judge"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strJudge;
m_pRs->Fields->GetItem(_variant_t("DetectResult"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strDetectResult;
m_pRs->Fields->GetItem(_variant_t("BacilusDensity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strBacilusDensity;
m_pRs->Fields->GetItem(_variant_t("FOVCount"))->Value=(_bstr_t)m_SlideBoxData.nFOVCount;
m_pRs->Fields->GetItem(_variant_t("bScan"))->Value=(_bstr_t)m_SlideBoxData.bScan;
m_pRs->Fields->GetItem(_variant_t("bJudge"))->Value=(_bstr_t)m_SlideBoxData.bJudge;
m_pRs->Fields->GetItem(_variant_t("TargetCount"))->Value=(_bstr_t)GetTargetCountInSlide();
m_pRs->Fields->GetItem(_variant_t("JudgedTargetCount"))->Value=(_bstr_t)GetJudgedTargetCountInSlide();
m_pRs->Update();
AfxMessageBox(_T("病人玻片信息表保存成功!"));
}
catch(...)
{
AfxMessageBox(_T("病人玻片信息表保存失败!"));
}
try
{
m_pRs->raw_Close();
//病人报告信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientRepInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("ReportDoctor"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strReportDoctor;
_variant_t varr;
varr.vt=VT_DATE;
varr.date=int(m_SlideBoxData.SlideInfo.dtReportData);
m_pRs->Fields->GetItem(_variant_t("ReportData"))->Value=(_bstr_t)varr;
m_pRs->Fields->GetItem(_variant_t("CompareJudge"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareJudge;
m_pRs->Fields->GetItem(_variant_t("CompareDetectResult"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareDetectResult;
m_pRs->Fields->GetItem(_variant_t("CompareBacilusDensity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareBacilusDensity;
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
_variant_t var;
var.vt=VT_DATE;
var.date=int(m_SlideBoxData.SlideInfo.dtDetectData);
m_pRs->Fields->GetItem(_variant_t("DetectData"))->Value=(_bstr_t)var;
_variant_t vart;
vart.vt=VT_DATE;
vart.date=DATE(m_SlideBoxData.SlideInfo.dtDetectTime);
m_pRs->Fields->GetItem(_variant_t("DetectTime"))->Value=(_bstr_t)vart;
//.........这里部分代码省略.........