I work with Windows-Mobile and Windows-CE
using SqlCE
and I dont know what better to do.
To open connection when the program open, run any
If worry about data lost because you are not calling Close()
frequently, you can execute your code within a transaction that commits changes to disk immediately:
using (SqlCeTransaction transaction = this.connection.BeginTransaction())
{
using (SqlCeCommand command = new SqlCeCommand(query, connection))
{
command.Transaction = transaction;
command.ExecuteNonQuery();
}
transaction.Commit(CommitMode.Immediate);
}
Of course, there is still some performance lost when using CommitMode.Immediate
too frequently.