Friday, February 17, 2012

Different behaviors when writing Database file into the SD Memory card.

Hi All,

I have seen some different behaviors when I am writing SQL Server compact edition Database file into SD Memory card or any user removable storage media.

The following Steps for reproducing these behaviors.

1. Set your database location is in the SD Memory card.

2. Create a database and establish session.

3. Writing first record into the database is done

4. Remove your SD card manually from the system

5. Try to write a Second record into the database

6. You will get the error from this "SqlCeWriteRecordProps" API call - This is fine.

7. Put your SD card back into the system.

8. Writing Second record again into the database is done - This is fine.

So far the behaviors are good after that

9. Remove your SD card manually from the system again

10. Try to write a Third record into the database

11. You will suppose to get the error from this "SqlCeWriteRecordProps" API call but you won’t get that error – I don’t know why?

12. Then Try to write a Forth record into the database

13. You won't get any error from the API call "SqlCeWriteRecordProps" and return status is success.

14. Now put your SD card back into the system.

15. Then write Fifth record but this time its writing record Third, Fourth and Fifth into the database.

Note:

I am clearing (means Free) my record structure everything after calling this function "SqlCeWriteRecordProps". So I don’t know why its wring Third, fourth and fifth record into the database.

Please Let me know your feedback.

Thanks,

Rajendran

This must be related to at what point of time the changes are flushed to SD card. It could be that during 2nd record write there is an attempt to flush the changes and the disk missing error. The next attempt to write records happens only during 5th write.

By default the flush interval is set to 10 seconds. This can be varied through connection string.

[If your question is answered, please mark it as answered]

-Thanks

No comments:

Post a Comment