Re: Problem with SQLServerCE

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thank you Laxmi, for you attention.
That isn't the case.
No automatic deployment is happening, for the application is already
installed and running in production.

But thanks anyway.

Best regards,

"Laxmi Narsimha Rao Oruganti [MSFT]" wrote:

If you are using VS for development, and there is a automatic deployment
happening; then the database attached to the project might be getting
deployed and overwriting the new and updated database file on the device.
So, you might perceive that as the changes are getting lost. You might want
to turn off 'Copy' of database file.

Thanks,
Laxmi

"Zowie" <Zowie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0011765E-2BB8-4680-B664-1707D1140790@xxxxxxxxxxxxxxxx
Hi Paul.
Thanks for your reply.
I had put this matter a little apart, as it happens rarely, and only
getting
back to it now.

I'm using SQL Mobile 3 on the devices.
Whe in failure mode, the inserts and updates don't work but no error is
given. For example, the following code executes completely, the
transaction
commits, the "id" value I get is the value on the DB, no exception is
thrown,
but the only record in table "TransactionID" (has only 1 record) remains
unchanged (the column "id" isn't incremented as it is normally).

SqlCeConnection connection = null;
SqlCeTransaction transaction = null;

try
{
connection = GetConnection(process);
connection.Open();
transaction = connection.BeginTransaction();
SqlCeCommand command = new SqlCeCommand("SELECT id from
TransactionID;", connection);
command.CommandType = System.Data.CommandType.Text;
command.Transaction = transaction;
SqlCeDataReader dataReader =
command.ExecuteReader(System.Data.CommandBehavior.Default);
dataReader.Read();
long id = dataReader.GetInt64(0);
dataReader.Close();
id++;
SqlCeCommand command2 = new
SqlCeCommand(String.Format("Update TransactionID SET id = {0};", id),
connection);
command2.CommandType = System.Data.CommandType.Text;
command2.Transaction = transaction;
int rowAffected = command2.ExecuteNonQuery();
if (rowAffected <= 0)
throw new ApplicationException("Erro ao actualizar ID
da
transacção na BD!");

transaction.Commit();
transaction.Dispose();
transaction = null;

command.Dispose();
command = null;
command2.Dispose();
command2 = null;
dataReader.Dispose();
dataReader = null;
return id;
}
catch (Exception ex)
{
transaction.Rollback();
}
finally
{
if (connection != null)
connection.Close();
}

Even if it isn't within a transaction, the result is the same, for
instance
the following code executes with no problem but, when in failure mode, the
record with id=0 remains unchanged:

SqlCeConnection conn = GetConnection(process);
try
{
conn.Open();
//Prepare command
SqlCeCommand command = new
SqlCeCommand(String.Format("Update ActivityRecords set lastCommunication =
'{0}' where ID = 0 ",

lastCommunication.ToString("yyyy-MM-dd HH:mm"), conn);
command.CommandType = System.Data.CommandType.Text;

res = command.ExecuteNonQuery();

command.Dispose();
command = null;
}
catch (Exception ex)
{

throw;
}
finally
{
conn.Close();
}



"Paul G. Tobey [eMVP]" wrote:

How do you know the data in the database didn't change? In other words,
you've told us a bit about how you are communicating with the database
when
everything works, but little about the actual failure mode. What code is
it
that's making a change that you say isn't getting to the database?

Also, we'll want to know what version of SQL Server Compact is on the
devices.

Paul T.

"Zowie" <zowiee@xxxxxxxxx> wrote in message
news:1a16bc28-f34b-48ea-a5f8-7bf64467148b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi.

I'm facing a problem and I ask if anybody can help me solving it.
I developed an application in C# (compact framework 2), running on a
Windows CE 5 industrial pc, that uses SqlServer CE to connect to a
local DBF file. The Database is acessed from several processes and
each process uses a different connection. The method Open() is called
everytime needed, and after use the Close() method is called. These
connections objects are maintained in a Static Class.
I have the application installed in several PCs and in some of them,
after a long time, although I get no error or exception, the dabase
"freezes", that is, the inserts/updates/deletes don't change the DBF
file. The strange thing is that, even after a reboot to the PC, it
keeps like that, the commands are executed correctely (the number of
rows affected returned is correct, etc) but nothing changes on the
Database. The only solution that I could find, that worked, was to
copy the application folder to a new folder on the same location in
the disk, changed that new folder name to match the old one and, after
restart, the Database file starts to get updated again.

I guess it could be related to some Operating system problem? Any
Ideas?

Thanks in advance,








.



Relevant Pages

  • Re: SQLCE 3.0 losing data after transaction
    ... You can also control the flush scheduling time using Connection String ... only SqlCeResultSet to get data from the database. ... CommandType.Text) As SqlCeCommand ... If Transaction IsNot Nothing Then ...
    (microsoft.public.sqlserver.ce)
  • Re: Connection types and speeds
    ... The memory used by holding the connection open is not ... All recordset inserts seen to consequently have 0ms execution time, ... actually written to the database while the code has regained control ... RecordsetClone of a form) when a transaction was rolled back, ...
    (microsoft.public.access.queries)
  • Re: Problem with SQLServerCE
    ... connection = GetConnection; ... SqlCeCommand command = new SqlCeCommand("SELECT id from ... that's making a change that you say isn't getting to the database? ...
    (microsoft.public.sqlserver.ce)
  • Re: Please Urgent - Update Data Source Problem ???
    ... then there's nothing to submit to the database. ... values that are only assigned by the DB once the update command is executed. ... > the connection. ... > schedule, and they can update the existing schedule, add new schedule ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: psycopg, transactions and multiple cursors
    ... > first time a change is made to the database. ... My intention is actually to keep them in the same transaction. ... >> cursor fetches one record from the database at a time). ... > generated from the same connection, ...
    (comp.lang.python)