[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CeSeekDataBaseEx fails error code 25 (SEEK_ERROR)

Posted on 2011-03-10
1
Medium Priority
?
475 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
Simple Linear Regression
Introduction to Processes
Suggested Courses
Course of the Month18 days, 9 hours left to enroll

826 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