Soft reset and Data Loss with ADO?

G

Guest

Could anyone explain to me what exactly happens during a soft reset and why I may be losing data? A little more about the specific problem...

I have a data collection application that occasionally locks ups (another issue) and requires a soft reset of the device. I am collecting data via a form that is bound to a Data Table. Upon pushing an enter button I update the Data Table using a Data Adapter. Under normal circumstances everything works great, however, if I do a soft reset in the middle of the application (thus simulating a lock up) and then synchronize with my database, things get fishy. Some data I entered is not in the database at all, while sometimes there is partial data. For example, if I entered 10 records and then reset I might see that 4 records transferred back to the database while the rest of the data was lost. This behavior seems very odd to me as I would expect that if the data is written to a data table on the device that it should permanantly be there? Can anyone explain what might be going on

Other potentially relevant info
-I'm using a Dell Axim X3
-Windows Mobile 200
-Using 'InTheHand' ADOCE

Any help would be greatly appreciated!

Thanks

Mik
 
G

Ginny Caughey [MVP]

Mike,

If you want your data to survive a soft reset, you need to flush it to a
file (SqlCE or CSV or XML) outside your app. If you want your data to
survive a hard reset, that file needs to be on a storage card.
--
Ginny Caughey
..Net Compact Framework MVP

Mike said:
Could anyone explain to me what exactly happens during a soft reset and
why I may be losing data? A little more about the specific problem....
I have a data collection application that occasionally locks ups (another
issue) and requires a soft reset of the device. I am collecting data via a
form that is bound to a Data Table. Upon pushing an enter button I update
the Data Table using a Data Adapter. Under normal circumstances everything
works great, however, if I do a soft reset in the middle of the application
(thus simulating a lock up) and then synchronize with my database, things
get fishy. Some data I entered is not in the database at all, while
sometimes there is partial data. For example, if I entered 10 records and
then reset I might see that 4 records transferred back to the database while
the rest of the data was lost. This behavior seems very odd to me as I
would expect that if the data is written to a data table on the device that
it should permanantly be there? Can anyone explain what might be going on?
 
C

Chris Stephens

Like Ginny says, you need to flush the db. I use to do this when using
EVB/ADO using the following which may help...


Declare Function CeMountDBVol Lib "Coredll" (ByVal pGUID As String, ByVal
lpszVol As String, ByVal dwFlags As Long) As Boolean
Declare Function CeFlushDBVol Lib "Coredll" (ByVal pGUID As String) As
Boolean
Declare Function CeUnmountDBVol Lib "Coredll" (ByVal pGUID As String) As
Boolean

Private Sub FlushDB()
Dim s As String
s = String(8, Chr(0))
Call CeMountDBVol(s, App.Path & cDATABASE_FILENAME, 3)
Call CeFlushDBVol(s)
Call CeUnmountDBVol(s)
End Sub


Chris

Mike said:
Could anyone explain to me what exactly happens during a soft reset and
why I may be losing data? A little more about the specific problem....
I have a data collection application that occasionally locks ups (another
issue) and requires a soft reset of the device. I am collecting data via a
form that is bound to a Data Table. Upon pushing an enter button I update
the Data Table using a Data Adapter. Under normal circumstances everything
works great, however, if I do a soft reset in the middle of the application
(thus simulating a lock up) and then synchronize with my database, things
get fishy. Some data I entered is not in the database at all, while
sometimes there is partial data. For example, if I entered 10 records and
then reset I might see that 4 records transferred back to the database while
the rest of the data was lost. This behavior seems very odd to me as I
would expect that if the data is written to a data table on the device that
it should permanantly be there? Can anyone explain what might be going on?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top