Solved

CeSeekDataBaseEx fails error code 25 (SEEK_ERROR)

Posted on 2011-03-10
1
453 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 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