Solved

CeSeekDataBaseEx fails error code 25 (SEEK_ERROR)

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

809 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