Solved

CeSeekDataBaseEx fails error code 25 (SEEK_ERROR)

Posted on 2011-03-10
1
452 Views
Last Modified: 2013-11-11
Hello,
I'm trying to search for a recond in a Windows CE database. : I do the falowing code :
This for the creation of the database
#define RF_TAG 0
#define RF_DESC 1
#define PL_RFID (MAKELONG(CEVT_LPWSTR,RF_TAG))
#define PL_DESC (MAKELONG(CEVT_LPWSTR,RF_DESC))

CEDBASEINFO dbInfo;
memset (&dbInfo, 0, sizeof(dbInfo));
wcscpy (dbInfo.szDbaseName , TEXT("RfIdTag"));
dbInfo.dwFlags =  CEDB_VALIDNAME ;
dbInfo.wNumSortOrder = 2;
dbInfo.rgSortSpecs[0].propid = PL_RFID;
dbInfo.rgSortSpecs[0].dwFlags = 0;
dbInfo.rgSortSpecs[1].propid = PL_DESC;
dbInfo.rgSortSpecs[1].dwFlags = 0;
dbInfo.dwDbaseType=0;

CeMountDBVol(guid,TEXT("\\RfIdDataBase.vol"),OPEN_EXISTING)
dbx = CeCreateDatabaseEx(guid, &dbInfo);

This part of code is working (there no error while running) becase the database is realy created.

Once the data base is created I insert a lot of records (this works to) the size of the database file is increasing:

CEPROPVAL myRec[2];
TCHAR * pRfTag = (TCHAR *) rfTag.GetString();
TCHAR * pRfDesc = (TCHAR *) rfDesc.GetString();


myRec[RF_TAG].propid = PL_RFID;
myRec[RF_TAG].val.lpwstr = pRfTag;
myRec[RF_DESC].propid = PL_DESC;
myRec[RF_DESC].val.lpwstr = pRfDesc;
CEOID rs = CeWriteRecordProps(m_CEDB,0,2,myRec);

My problem is when i try to find a record using CeSeekDataBaseEx.


      WORD cProps = 1;
      //LPByte pBuff = NULL;
      DWORD cByte = 0;
      CEPROPVAL look;
      USES_CONVERSION;


      look.propid = PL_RFID;
      look.val.lpwstr = T2W(lpszItem);
      look.wFlags = 0;
      look.wLenData = 0;
      m_CEDB= OpenDataBase(_T("rfidDB.db"),0,CEDB_AUTOINCREMENT,NULL,0);
      
      if (m_CEDB != INVALID_HANDLE_VALUE)
      {
            CEOID oidSeek = CeSeekDatabaseEx(m_CEDB, CEDB_SEEK_BEGINNING, 0, 0,NULL);
            if(oidSeek == NULL)
            {
                  // error, return error
                  DWORD err = GetLastError();
                  CString sErr=_T("");
                  sErr.Format(TEXT("Erreur CeSeekDatabaseEx : %d"),err);
                  MessageBox(GetForegroundWindow(),sErr,TEXT("ReadRecord"),MB_ICONERROR);
            }
            
            
            
            CEOID ret = CeSeekDatabaseEx(m_CEDB,CEDB_SEEK_VALUEFIRSTEQUAL,(DWORD )&look,1,& cByte);
            if (ret != 0 )
            {
                  MessageBox(GetForegroundWindow(),TEXT("Un enregistrement Trouve"),_T("ReadRecord"),MB_ICONINFORMATION);
            }
            else
            {
                              DWORD err = GetLastError();
                              CString sErr=_T("");
                              sErr.Format(TEXT("Erreur CeSeekDatabaseEx : %d"),err);
                              MessageBox(GetForegroundWindow(),sErr,TEXT("ReadRecord"),MB_ICONERROR);
                              
            }
            CloseHandle(m_CEDB);
      }



The first instruction CEOID oidSeek = CeSeekDatabaseEx(m_CEDB, CEDB_SEEK_BEGINNING, 0, 0,NULL); seems to work because oidSeek is not null.
The second one CEOID ret = CeSeekDatabaseEx(m_CEDB,CEDB_SEEK_VALUEFIRSTEQUAL,(DWORD )&look,1,& cByte); does not work. The record i'am looking for is in the database for sure :) i inserted it at least one time.

The error code i get is 25 this seems to be SEEK_ERROR ...

So can some one told me where i get wrong please ? I'm lost :)

Thanks for your help
0
Comment
Question by:George
1 Comment
 

Accepted Solution

by:
George earned 0 total points
ID: 35096836
Ok In fact EveryThing Is Ok just a problem whith the chair / screen interface ... Two lines where commented so there was no real data in the database :))
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now