Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CeSeekDataBaseEx fails error code 25 (SEEK_ERROR)

Posted on 2011-03-10
1
Medium Priority
?
472 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

650 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