Showing posts with label sqlce. Show all posts
Showing posts with label sqlce. Show all posts

Monday, March 19, 2012

[SQLCE Mobile]Do Select during Transaction

Hi,

I need to do a Select and after a Insert during a Transaction. But when i want to commit this transaction i've the following error message :

The transaction can not be committed if there are any opened cursors in the scope of this transaction. Make sure all data readers / result sets are explicitly closed before committing the change.

I don't understand this error message. How can i close my cursors.

Before my Insert i'm closing my SqlCeDataReader and i dispose it. My SqlCeCommand are also closed and dispose.

Do you have any ID?

Thanks.

Hi Kardath,

I tried to repro this here and could not reproduce the problem. I am able to have both INSERT and SELECT in a single transaction. Can you please try to dispose the all the sqlce objects and see if the problem disappers?

Thanks,

Laxmi

Thursday, February 16, 2012

[Bug?]Exception thrown in SSCE 3.5 Beta2 but not in 3.5 beta1.

Hi,

I replace the reference assembly System.Data.SqlServerCe with version 3.5 beta2 in Microsoft.Practices.EnterpriseLibrary.Data.SqlCe. When I used the Data.SqlCe block in application, an exception ("Cannot access a disposed object named SqlCeConnection") threw. This didn't occur in SSCE 3.5 beta1 and early versions.

Finally I found the difference between beta1 and beta2.

In the SqlCeConnection class, there is a RemoveWeakReference method. this is code snippet of beta1:

internal void RemoveWeakReference(object value) { if (this.weakReferenceCache != null) { this.weakReferenceCache.Remove(value); } }

and this is for beta2:

internal void RemoveWeakReference(object value) { if (this.weakReferenceCache == null) { throw new ObjectDisposedException("SqlCeConnection"); } this.weakReferenceCache.Remove(value); }

So, if we dispose a connection before a command, such as:

SqlCeConnection cn;SqlCeCommand cmd;... cn.Dispose();cmd.Dispose(); // Error, an exception will be threw. Is it a bug of Beta2?

This is a issue in Beta2. Most probably we will fix in SSCE 3.5 RTM.

The Bug Id: 13211 tracks this issue.

-Vamshi Krishna.

[Bug?]Exception thrown in SSCE 3.5 Beta2 but not in 3.5 beta1.

Hi,

I replace the reference assembly System.Data.SqlServerCe with version 3.5 beta2 in Microsoft.Practices.EnterpriseLibrary.Data.SqlCe. When I used the Data.SqlCe block in application, an exception ("Cannot access a disposed object named SqlCeConnection") threw. This didn't occur in SSCE 3.5 beta1 and early versions.

Finally I found the difference between beta1 and beta2.

In the SqlCeConnection class, there is a RemoveWeakReference method. this is code snippet of beta1:

internal void RemoveWeakReference(object value) { if (this.weakReferenceCache != null) { this.weakReferenceCache.Remove(value); } }

and this is for beta2:

internal void RemoveWeakReference(object value) { if (this.weakReferenceCache == null) { throw new ObjectDisposedException("SqlCeConnection"); } this.weakReferenceCache.Remove(value); }

So, if we dispose a connection before a command, such as:

SqlCeConnection cn;SqlCeCommand cmd;... cn.Dispose();cmd.Dispose(); // Error, an exception will be threw. Is it a bug of Beta2?

This is a issue in Beta2. Most probably we will fix in SSCE 3.5 RTM.

The Bug Id: 13211 tracks this issue.

-Vamshi Krishna.