当前位置: 首页>>代码示例>>C++>>正文


C++ CRecordset::MoveFirst方法代码示例

本文整理汇总了C++中CRecordset::MoveFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ CRecordset::MoveFirst方法的具体用法?C++ CRecordset::MoveFirst怎么用?C++ CRecordset::MoveFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRecordset的用法示例。


在下文中一共展示了CRecordset::MoveFirst方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getProvinceid

int CMyDatabase::getProvinceid(CString provinceName)
{
	CString SqlString2 = _T("SELECT * FROM Province WHERE Province='")+provinceName+_T("' ");
	CRecordset *record;
	record= new CRecordset(this->m_nDatabase);
	record->Open(CRecordset::dynaset,SqlString2);
	CString tempStr=_T("0");
	int PID=0;
	if (!record->IsEOF())
	{
		record->MoveFirst();
		record->GetFieldValue(_T("ProvinceID"),tempStr);
	}
	PID	= _ttoi(tempStr) ;
	return PID;
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:16,代码来源:MyDatabase.cpp

示例2: getTypesID

int CMyDatabase::getTypesID(CString TypesName)
{
	CString SqlString2 = _T("SELECT * FROM types WHERE Name='")+TypesName+_T("' ");
	CRecordset *record;
	record= new CRecordset(this->m_nDatabase);
	record->Open(CRecordset::dynaset,SqlString2);
	CString tempStr=_T("0");
	int PID=0;
	if (!record->IsEOF())
	{
		record->MoveFirst();
		record->GetFieldValue(_T("CID"),tempStr);
	}
	PID	= _ttoi(tempStr) ;
	return PID;
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:16,代码来源:MyDatabase.cpp

示例3: OnMove

BOOL CRecordView::OnMove(UINT nIDMoveCommand)
{
    CRecordset* pSet = OnGetRecordset();
    if (pSet->CanUpdate() && !pSet->IsDeleted())
    {
        pSet->Edit();
        if (!UpdateData())
            return TRUE;

        pSet->Update();
    }

    switch (nIDMoveCommand)
    {
    case ID_RECORD_PREV:
        pSet->MovePrev();
        if (!pSet->IsBOF())
            break;

    case ID_RECORD_FIRST:
        pSet->MoveFirst();
        break;

    case ID_RECORD_NEXT:
        pSet->MoveNext();
        if (!pSet->IsEOF())
            break;
        if (!pSet->CanScroll())
        {
            // clear out screen since we're sitting on EOF
            pSet->SetFieldNull(NULL);
            break;
        }

    case ID_RECORD_LAST:
        pSet->MoveLast();
        break;

    default:
        // Unexpected case value
        ASSERT(FALSE);
    }

    // Show results of move operation
    UpdateData(FALSE);
    return TRUE;
}
开发者ID:Rupan,项目名称:winscp,代码行数:47,代码来源:dbview.cpp

示例4: addTypeName

void CMyDatabase::addTypeName(CString TypeName,CString PTypeName)
{
	CString SqlString2 = _T("SELECT * FROM types WHERE Name='")+PTypeName+_T("' ");
	CRecordset *record;
	record= new CRecordset(this->m_nDatabase);
	record->Open(CRecordset::dynaset,SqlString2);
	CString tempStr=_T("0");
	if (!record->IsEOF())
	{
		record->MoveFirst();
		record->GetFieldValue(_T("CID"),tempStr);
	}

	CString SqlString;
	SqlString.Format(_T("INSERT INTO types (Name,PID) VALUES('%s',%s)"),TypeName,tempStr);
	this->m_nDatabase->ExecuteSQL(SqlString);
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:17,代码来源:MyDatabase.cpp

示例5: ThreadUpdatePLSModel

UINT ThreadUpdatePLSModel(LPVOID lpParam)
{
	double coeff=2;//系数

	CDBManageTrueDlg* pCDBManageTrueDlg=(CDBManageTrueDlg*)lpParam;
	CTrueWineLib TrueWineLib;

	CWineTypeIndex WineTypeIndex;
	CAlcoholTypeIndex AlcoholTypeIndex;
	CFlavourTypeIndex FlavourTypeIndex;
	CBrandTypeIndex BrandTypeIndex;

	CPLSModel PLSModel;

	map<CString,int> map_TrueWineIndex;
	map<CString, int> map_AlcoholContent;
	map<CString,int> map_Flavour;
	map<CString,int> map_Brand;

	if(!PLSModel.Open())
	{
		pCDBManageTrueDlg->MessageBox(L"打开PLS模型库失败",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	if(!PLSModel.IsEOF())
	{
		PLSModel.MoveFirst();
	}

	while(!PLSModel.IsEOF())
	{
		PLSModel.Delete();
		PLSModel.MoveNext();
	}

	//打开索引库
	if(!WineTypeIndex.Open())
	{
		pCDBManageTrueDlg->MessageBox(L"打开真酒索引库失败",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	if(0==WineTypeIndex.GetRecordCount())
	{
		pCDBManageTrueDlg->MessageBox(L"光谱管理信息出现错误,请尝试更新!",L"更新模型失败",MB_ICONERROR);
		return -1;
	}

	if(!AlcoholTypeIndex.Open())
	{
		pCDBManageTrueDlg->MessageBox(L"打开酒精度索引库失败",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	if(0==AlcoholTypeIndex.GetRecordCount())
	{
		pCDBManageTrueDlg->MessageBox(L"光谱管理信息出现错误,请尝试更新!",L"更新模型失败",MB_ICONERROR);
		return -1;
	}

	if(!FlavourTypeIndex.Open())
	{
		pCDBManageTrueDlg->MessageBox(L"打开香型索引库失败",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	if(0==FlavourTypeIndex.GetRecordCount())
	{
		pCDBManageTrueDlg->MessageBox(L"光谱管理信息出现错误,请尝试更新!",L"更新模型失败",MB_ICONERROR);
		return -1;
	}

	if(!BrandTypeIndex.Open())
	{
		pCDBManageTrueDlg->MessageBox(L"打开品牌索引库失败",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	if(0==BrandTypeIndex.GetRecordCount())
	{
		pCDBManageTrueDlg->MessageBox(L"光谱管理信息出现错误,请尝试更新!",L"更新模型失败",MB_ICONERROR);
		return -1;
	}
	/////////////////////////
	WineTypeIndex.MoveFirst();
	while(!WineTypeIndex.IsEOF())
	{
		map_TrueWineIndex[WineTypeIndex.m_WineName]=WineTypeIndex.m_TypeIndex;
		WineTypeIndex.MoveNext();
	}


	AlcoholTypeIndex.MoveFirst();
	while(!AlcoholTypeIndex.IsEOF())
	{
		map_AlcoholContent[AlcoholTypeIndex.m_AlcoholContent]=AlcoholTypeIndex.m_AlcoholIndex;
		AlcoholTypeIndex.MoveNext();
	}
	AlcoholTypeIndex.MoveFirst();

	FlavourTypeIndex.MoveFirst();
	while(!FlavourTypeIndex.IsEOF())
	{
		map_Flavour[FlavourTypeIndex.m_Flavour]=FlavourTypeIndex.m_FlavourIndex;
//.........这里部分代码省略.........
开发者ID:wth515812076,项目名称:WineAnaSys,代码行数:101,代码来源:DBManageTrueDlg.cpp

示例6: UpdateIndexTable

void CDBManageTrueDlg::UpdateIndexTable(void)
{
	//CTrueWineLib TrueWineLib;

	CDatabase m_db;
	CRecordset rs;
	m_db.OpenEx(_T("DSN=白酒鉴定与溯源数据库;"),CDatabase::noOdbcDialog);
	rs.m_pDatabase = &m_db;

	CString WineName;
	CString AlcoholContent;
	CString Flavour;
	CString Brand;
	CString ProductionBatchNo;

	//更新白酒类型索引
	CWineTypeIndex WineTypeIndex;

	if(!WineTypeIndex.Open())
	{
		MessageBox(L"打开光谱索引库失败",L"更新失败",MB_ICONERROR);
		return;
	}
	if(!WineTypeIndex.IsEOF())
	{
		WineTypeIndex.MoveFirst();
		while(!WineTypeIndex.IsEOF())
		{
			WineTypeIndex.Delete();
			WineTypeIndex.MoveNext();
		}
	}
	CString command=_T("SELECT DISTINCT WineName,AlcoholContent,Flavour,Brand,ProductionBatchNo FROM TrueWineLib");
	if(!rs.Open(AFX_DB_USE_DEFAULT_TYPE,command))
	{
		MessageBox(L"打开真酒库失败",L"更新失败",MB_ICONERROR);
		return;
	}

	if(!rs.IsEOF())
	{
		int count=1;
		rs.MoveFirst();
		while(!rs.IsEOF())
		{
			rs.GetFieldValue(L"WineName",WineName);
			rs.GetFieldValue(L"AlcoholContent",AlcoholContent);
			rs.GetFieldValue(L"Flavour",Flavour);
			rs.GetFieldValue(L"Brand",Brand);
			rs.GetFieldValue(L"ProductionBatchNo",ProductionBatchNo);

			WineTypeIndex.AddNew();
			WineTypeIndex.m_WineName=WineName;   //不知道为什么使用了select distinct 得到某几列记录时,自动把这一列分配给最前面的类型相同的列
			WineTypeIndex.m_AlcoholContent=AlcoholContent;
			WineTypeIndex.m_Flavour=Flavour;
			WineTypeIndex.m_Brand=Brand;
			WineTypeIndex.m_ProductionBatchNo=ProductionBatchNo;
			WineTypeIndex.m_TypeIndex=count;
			count++;
			rs.MoveNext();
			WineTypeIndex.Update();
		}
	}
	rs.Close();
	//更新酒精度索引
	CAlcoholTypeIndex AlcoholTypeIndex;

	if(!AlcoholTypeIndex.Open())
	{
		MessageBox(L"打开光谱索引库失败",L"更新失败",MB_ICONERROR);
		return;
	}
	if(!AlcoholTypeIndex.IsEOF())
	{
		AlcoholTypeIndex.MoveFirst();
		while(!AlcoholTypeIndex.IsEOF())
		{
			AlcoholTypeIndex.Delete();
			AlcoholTypeIndex.MoveNext();
		}
	}

	command=_T("SELECT DISTINCT AlcoholContent FROM TrueWineLib");
	if(!rs.Open(AFX_DB_USE_DEFAULT_TYPE,command))
	{
		MessageBox(L"打开真酒库失败",L"更新失败",MB_ICONERROR);
		return;
	}
	CString alcohol;


	if(!rs.IsEOF())
	{
		rs.MoveFirst();
		int i=1;
		while(!rs.IsEOF())
		{		
			rs.GetFieldValue(_T("AlcoholContent"),alcohol); 
			AlcoholTypeIndex.AddNew();
			AlcoholTypeIndex.m_AlcoholContent=alcohol;
//.........这里部分代码省略.........
开发者ID:wth515812076,项目名称:WineAnaSys,代码行数:101,代码来源:DBManageTrueDlg.cpp


注:本文中的CRecordset::MoveFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。