Storing strings with CeWriteRecordProps

Storing strings with CeWriteRecordProps

Post by Michael Rausc » Wed, 16 Jul 2003 22:59:53



Storing LPWSTR strings with CeWriteRecordProps is not working for me.

I defined a writing buffer as:

CEPROPVAL Record[11];

Then I set it for a string value as e.g.

LSRecord[4].val.lpwstr = pProperty->GetString();

pProperty is a pointer to an object of the class CCeDBProp.

Writing the array out to the database creates no error message, but a valid
object id.

When I read the record back from the opened database of a mounted database
volume, I get the following errors:

1. The number of properties is no longer 11, but the number of non-string
properties  + 1.
2. None of the string fields contains a valid value.

The non-string values are all read correctly.

Any hints or ideas are highly appreciated.

 
 
 

Storing strings with CeWriteRecordProps

Post by Susan Loh [MS » Thu, 17 Jul 2003 14:11:14


What CEPROPID are you using for your strings?  You need to use a unique
CEPROPID for each type of string.  Eg.

#define PROPID_FIRSTNAME MAKELONG(CEVT_LPWSTR, 1)
#define PROPID_MIDDLENAME MAKELONG(CEVT_LPWSTR, 2)
#define PROPID_LASTNAME  MAKELONG(CEVT_LPWSTR, 3)
.. etc.

If you don't use a unique ID then only the last value with the given PROPID
gets written into the record.
Also make sure to zero out the wFlags value in the CEPROPVAL struct when
you write the data.

Sue

_____________________________________________________________
This posting is provided "AS IS" with no warranties, and confers no rights.
_____________________________________________________________
Windows Embedded FAQ
(http://www.microsoft.com/windows/embedded/faq/default.asp)

--------------------
| Subject: Storing strings with CeWriteRecordProps

| Organization: Your Company

| User-Agent: Xnews/5.04.25
| Newsgroups: microsoft.public.windowsce.embedded.vc
| Date: Tue, 15 Jul 2003 06:59:53 -0700
| NNTP-Posting-Host: wireless-160.transkom.net 212.28.40.48
| Lines: 1        
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.windowsce.embedded.vc:25186
| X-Tomcat-NG: microsoft.public.windowsce.embedded.vc
|
| Storing LPWSTR strings with CeWriteRecordProps is not working for me.
|
| I defined a writing buffer as:
|
| CEPROPVAL Record[11];
|
|
| Then I set it for a string value as e.g.
|
| LSRecord[4].val.lpwstr = pProperty->GetString();
|
| pProperty is a pointer to an object of the class CCeDBProp.
|
|
| Writing the array out to the database creates no error message, but a
valid
| object id.
|
|
| When I read the record back from the opened database of a mounted
database
| volume, I get the following errors:
|
|
| 1. The number of properties is no longer 11, but the number of non-string
| properties  + 1.
| 2. None of the string fields contains a valid value.
|
|
| The non-string values are all read correctly.
|
|
| Any hints or ideas are highly appreciated.
|

 
 
 

Storing strings with CeWriteRecordProps

Post by Michael Rausc » Fri, 18 Jul 2003 17:23:45


I set the flags correctly, but I made a mistake with the IDs.

Problem solved, thank you very much.

   Regards,

        Michael



> What CEPROPID are you using for your strings?  You need to use a
> unique CEPROPID for each type of string.  Eg.

> #define PROPID_FIRSTNAME MAKELONG(CEVT_LPWSTR, 1)
> #define PROPID_MIDDLENAME MAKELONG(CEVT_LPWSTR, 2)
> #define PROPID_LASTNAME  MAKELONG(CEVT_LPWSTR, 3)
> .. etc.

> If you don't use a unique ID then only the last value with the given
> PROPID gets written into the record.
> Also make sure to zero out the wFlags value in the CEPROPVAL struct
> when you write the data.

> Sue

> _____________________________________________________________
> This posting is provided "AS IS" with no warranties, and confers no
> rights. _____________________________________________________________
> Windows Embedded FAQ
> (http://www.microsoft.com/windows/embedded/faq/default.asp)