CeSeekDatabaseEx() problem
- From: Steve Kelley <skelley@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 09 Oct 2006 15:49:27 -0500
Hello all,
I am having trouble with the CeSeekDatabaseEx() function when using the CEDB_SEEK_VALUEFIRSTEQUAL flag. Below is some code that illustrates what I am trying to do along with some experimental code. You'll notice that if I read from the record set after seeking to the beginning I set a local CEPROPVAL struct = to the result. That works. As an experiment I then use that result to seek on the value of the first CEPROPVAL returned. That doesn't work. Can anyone tell me why? I want to be able to pass into the function a CEPROPVAL preloaded with the propid field set and get the record but I always get an ERROR_SEEK on the return from GetLastError().
int VistaDB::ReadRecord(CEPROPVAL *prop)
{
DWORD index;
CEOID oid;
WORD nPropIDs;
PBYTE pBuff;
DWORD size;
CEPROPVAL *propval;
nPropIDs = m_nPropVal;
pBuff = 0;
oid = CeSeekDatabaseEx(m_dbHandle, CEDB_SEEK_BEGINNING, 0, 0, &index);
if (oid)
{
oid = CeReadRecordPropsEx(m_dbHandle, CEDB_ALLOWREALLOC, &nPropIDs, NULL, &(LPBYTE)pBuff, &size, 0);
propval = (CEPROPVAL *)pBuff;
}
oid = CeSeekDatabaseEx(m_dbHandle, CEDB_SEEK_VALUEFIRSTEQUAL, (DWORD)&propval, 1, &index);
if (!oid)
{
index = GetLastError();
switch (index)
{
case ERROR_INVALID_PARAMETER:
index = -1;
break;
case ERROR_INVALID_HANDLE:
index = -1;
break;
case ERROR_KEY_DELETED:
index = -1;
break;
case ERROR_NOT_ENOUGH_MEMORY:
index = -1;
break;
case ERROR_SEEK:
index = -1;
break;
case ERROR_SHARING_VIOLATION:
index = -1;
break;
default:
break;
}
}
else
{
if (*prop != NULL)
{
LocalFree(*prop);
}
oid = CeReadRecordPropsEx(m_dbHandle, CEDB_ALLOWREALLOC, &nPropIDs, NULL, &(LPBYTE)pBuff, &size, 0);
prop = (CPROPVAL *)pBuff;
}
return index;
}
Thanks in advance.
Steve Kelley
skelley@xxxxxxxxxxxxxxxxxxxxx
.
- Prev by Date: Re: Windows CE Platform Manager Configuration - real device Qtek 9000
- Next by Date: Re: ActiveSync - Prevent users from placing files into the Explore
- Previous by thread: Run windows ce 5 emulator into Visual Studio 2005
- Next by thread: Re: ActiveSync - Prevent users from placing files into the Explore
- Index(es):