Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Save data on PDA database (.sdf file)

Hi there,
I am making a stock take application for MC50 Pocket PC which runs on Windows 2003 Mobile OS. I have written some code to update stock after every qty entered for a stock item. This function updates the database (.sdf file on PDA) with the entered qty. I have found out that if battery runs out or if the PDA is hard rebooted WHILE doing stock take, my stock take is not saved at all. Seems like the data is rolled back or is not committed when PDA is rebooted while doing stock take. Please help me to save data every time i enter qty for a stock item even if the PDA is hard rebooted. Thanks very much. - KARAN

My code is:

"
#region Update Stock Take by Ref number
/// <summary>
/// updates stock take table with new qty by ref number
/// </summary>
/// <param name="ref_number"></param>
/// <param name="qty"></param>
/// <returns></returns>
internal string UpdateStockTakeByRefNumber(string ref_number,decimal qty, string column)
{
string sql = "UPDATE Stock_Take SET " + column +" = ? , Updated_By_PDA = 1 WHERE Ref_Number = ?";
try
{
SqlCeHelper.ExecuteScalar(cnStockLink,sql, new SqlCeParameter(column,qty), new SqlCeParameter("Ref_Number",ref_number));
}
catch (SqlCeException e)
{
MessageBox.Show(e.Message.ToString());
}
return "Y";
}
#endregion
"
[1633 byte] By [karanjsingh] at [2007-11-11 11:58:19]
# 1 Re: Save data on PDA database (.sdf file)
If it loses power or is rebooted then all connections are lost so there really isn't that much you can do about that.
Hack at 2007-11-12 0:15:14 >