Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hello,

I am trying to access a record I have inserted into a database, but when I try to grab its contents I get NULL. I make the record like this:

AEEDBField f;
f.fName = AEEDBFIELD_TEXT;
f.fType = AEEDB_FT_STRING;
AECHAR data[8];
WSPRINTF(data, 14, L"HELLO!\0");
f.pBuffer = data;
f.wDataLen = 8;

if(IDATABASE_CreateRecord(pMe->m_pDatabase, &f, 1) == NULL)
return FALSE;

and I access it later in the code like this:

IDATABASE_Reset(pMe->m_pDatabase);
IDBRecord * r = IDATABASE_GetNextRecord(pMe->m_pDatabase);
AECHAR * a = IDBRECORD_GetFieldString(r);

any idea why "a" would be NULL? I can open the database file in notepad and see that the record does exist in there.

Thanks for your help!

I think you should assign f.wDataLen = 14 and also use IDBRECORD_NextField before using IDBRECORD_GetFieldString

I think you should assign f.wDataLen = 14 and also use IDBRECORD_NextField before using IDBRECORD_GetFieldString

D'oh! I just copied and pasted that WSPRINTF code, stupid me..
Thanks for your help! I didn't know I had to call IDBRECORD_NextField() in order to grab the string, the documentation wasn't so clear on this, or maybe I just missed it!

D'oh! I just copied and pasted that WSPRINTF code, stupid me..
Thanks for your help! I didn't know I had to call IDBRECORD_NextField() in order to grab the string, the documentation wasn't so clear on this, or maybe I just missed it!