집 >데이터 베이스 >MySQL 튜토리얼 >数据库技术在BREW中的应用
欢迎进入IT技术社区论坛,与200万技术人员互动交流 >>进入 6、读取记录域 代码: boolean GetRecordByID(IDatabase * pIDatabase, uint16 u16RecID) { IDBRecord * pIDBRec1 = NULL; AEEDBFieldType fType; AEEDBFieldName fName; uint16 fLen; byte * data
欢迎进入IT技术社区论坛,与200万技术人员互动交流 >>进入
6、读取记录域
代码:
boolean GetRecordByID(IDatabase * pIDatabase, uint16 u16RecID)
{
IDBRecord * pIDBRec1 = NULL;
AEEDBFieldType fType;
AEEDBFieldName fName;
uint16 fLen;
byte * data = NULL;;
// This will reset the record Index to 0.
IDATABASE_Reset (pIDatabase);
// IDATABASE_GetRecordByID: returns a pointer to the record whose
// record ID is specified.
pIDBRec1 = IDATABASE_GetRecordByID (pIDatabase, u16RecID);
// Get the raw data of the field
for(;;)
{
// Get record 1 first field and display it
fType = IDBRECORD_NextField (pIDBRec1, &fName, &fLen);
data = IDBRECORD_GetField (pIDBRec1, &fName, &fType, &fLen);
if (data != NULL)
{
switch(fName)
{
case AEEDBFIELD_FIRSTNAME;
break;
case AEEDBFIELD_LASTNAME;
break;
case AEEDBFIELD_ADDRESS;
break;
default:
break;
}
}
else
{
break; //break for
}
}
// Now remove record 1.
IDBRECORD_Release(pIDBRec1);
return TRUE;
}
[1] [2] [3]