Showing posts with label opening. Show all posts
Showing posts with label opening. Show all posts

Monday, March 19, 2012

"SQL Server Mobile encountered problems when opening the database."

Hi,

I am writing an application for a device (HP IPAQ 6828) having Windows Mobile 5.0 using

-MS .NET Compact Framework 2.0 SP-1
-SQL Mobile 2005.
-VS 2005 .NET

The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.

"SQL Server Mobile encountered problems when opening the database."

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

I also checked the the connection string and it seems to be fine. Both my device and server can ping each other. Moreever I can also access the Web syncronization folder(on server) from the device.

Is anyone having a resolution for this?


This problem may be caused by many reasons.

The most common is not disposing the replication object or other data related objects. Make sure there isn't any other arround.
Sql Mobile 2005 allows multiple connections except while syncronizing.

Another known cause is a bad path on the connection string.

Other forum entries referring this problem:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=334604&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=478902&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=961633&SiteID=1|||

Hi,

I finally found the solution to this...

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

(Note: I am trying to synchronize on an exisiting database)

The problem was since my database is already in use by my application and I am trying to sync the same DB. Synchronization cannot occur if the connection is already open by the application. Sql Mobile 2005 allows multiple connections except while synchronizing.

Therefore we need to close and dispose the open connection used by the application as under before attempting to synchonize.

(Below is the sample code)

private sub SampleSync()

sharedCon.close
sharedCon.dispose

try

' TO DO: Set replication object properties here

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

finally
repl.dispose
end try

' TO DO: Open your shared connection here if required.

End sub

Note: Most of the times the connection string also causes a problem. A sample connection string would look like this...

repl.SubscriberConnectionString ="\Program Files\YourAppName\YourDb.sdf;Password =<...>"

"Show Group Subtotals" Reappear when opening a report

This should be pretty simple...

I have a report that I've designed in Report Builder with many groups. I added an aggregate. By default, it subtotals at each level. For all the groups (but 1) I right clicked on the group header and unchecked "Show Group Subtotals".

I save the report to the report server in "My Reports". When I open the report, all of the subtotals return.

Does anyone know why this occurs? I'm going to have a hard time selling this to business users if they have to go through each group and uncheck the "Show Group Subtotals" every time they want to modify a report.

Regards,


Dan

This is a known issue that is fixed in internal builds. The release in which this fix will be available has not been determined yet. If it is a showstopper for you, you might consider calling customer support and requesting a hotfix.

|||

Thanks for the quick response! I'll wait to see how users react before pursuing it further.

Thanks again,

Dan