Merge Replication/SQL Server CE/Smart Device Application/Pocket PC Error

sbfay

Newcomer
Joined
Aug 22, 2003
Messages
2
First things first: I'm a newbie to VB.NET (somewhat), that has inherited this problem. This application seems to run fine when running under one account, but when I copied the application to my own PC, I have the problem below.

I'm hoping someone can help me out with a problem I'm having with a Pocket PC application I'm developing with VB.NET and the .NET Compact Framework. Also, you should know that I'm developing this application for SQL Server CE/SQL Server with Merge Replication.

Here's the snippet of code that's failing:

g_sAppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
g_sDBPath = g_sAppPath & "\TechMobile.sdf"
...

If Not File.Exists(g_sDBPath) Then
'this evaluates to "FALSE" so we do not get this msgbox
MsgBox("Unable to import database.")
GoTo Unsuccessful
End If

'compact the database
Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=" & MainMod.g_sDBPath)
Try
'the following line fails --
engine.Compact("Data Source=" & g_sDBPath & ".tmp")
File.Delete(MainMod.g_sDBPath)
File.Move(g_sDBPath & ".tmp", MainMod.g_sDBPath)
engine.Dispose()
Catch ex As SqlCeException
MsgBox(ex.Message)
End Try

The result of my "ex.Message" is:

The SQL Server CE database cannot be compacted. [,,,,,]

Any ideas why this might be? I have a feeling it might be related to Replication security, but I don't have the foggiest on how to test for that or continue.

Any help would be very...well...HELPFUL. :)

Thanks very much!
Steve
 
Back
Top