예제 #1
0
//加载种类
void CServerListCenter::LoadGameKind(IDataBase * pIDataBase)
{
	//执行命令
	pIDataBase->ClearAllParameters();
	pIDataBase->SetSPName(TEXT("GSP_GP_LoadKindInfo"));
	pIDataBase->ExecuteCommand(true);

	//读取信息
	tagGameKind GameKindRead;
	memset(&GameKindRead,0,sizeof(GameKindRead));
	while (pIDataBase->IsEndRecordset()==false)
	{
		//读取信息
		pIDataBase->GetFieldValue(TEXT("TypeID"),GameKindRead.wTypeID);
		pIDataBase->GetFieldValue(TEXT("KindID"),GameKindRead.wKindID);
		pIDataBase->GetFieldValue(TEXT("SortID"),GameKindRead.wSortID);
		pIDataBase->GetFieldValue(TEXT("MaxVersion"),GameKindRead.dwMaxVersion);
		pIDataBase->GetFieldValue(TEXT("KindName"),GameKindRead.szKindName,sizeof(GameKindRead.szKindName));
		pIDataBase->GetFieldValue(TEXT("ProcessName"),GameKindRead.szProcessName,sizeof(GameKindRead.szProcessName));
		pIDataBase->MoveToNext();

		//插入信息
		InsertGameKind(&GameKindRead);
	}
	pIDataBase->CloseRecordset();

	return;
}
//加载种类
void CServerListCenter::LoadGameKind(CDataBaseAide & DataBaseAide)
{
	try
	{
		//执行命令
		DataBaseAide.ResetParameter();
		DataBaseAide.ExecuteProcess(TEXT("GSP_LoadGameKindItem"),true);
	}
	catch (IDataBaseException * pIException)
	{
		//错误信息
		LPCTSTR pszDescribe=pIException->GetExceptionDescribe();
		CTraceService::TraceString(pszDescribe,TraceLevel_Exception);
	}
	//变量定义
	tagGameKind GameKindRead;
	ZeroMemory(&GameKindRead,sizeof(GameKindRead));

	//获取数据
	IDataBase * pIDataBase=(IDataBase *)DataBaseAide.GetDataBase(IID_IDataBase,VER_IDataBase);

	//读取信息
	while (pIDataBase->IsRecordsetEnd()==false)
	{
		//读取信息
		GameKindRead.wTypeID=DataBaseAide.GetValue_WORD(TEXT("TypeID"));
		GameKindRead.wKindID=DataBaseAide.GetValue_WORD(TEXT("KindID"));
		GameKindRead.wSortID=DataBaseAide.GetValue_WORD(TEXT("SortID"));
		GameKindRead.dwMaxVersion=DataBaseAide.GetValue_DWORD(TEXT("MaxVersion"));
		DataBaseAide.GetValue_String(TEXT("KindName"),GameKindRead.szKindName,CountArray(GameKindRead.szKindName));
		DataBaseAide.GetValue_String(TEXT("ProcessName"),GameKindRead.szProcessName,CountArray(GameKindRead.szProcessName));

		//移动记录
		pIDataBase->MoveToNext();

		//插入信息
		InsertGameKind(&GameKindRead);
	}

	//关闭记录
	pIDataBase->CloseRecordset();

	return;
}