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

sbfay

New member
Joined
Aug 22, 2003
Messages
2
First things first: Im 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.

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

Heres the snippet of code thats 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 dont have the foggiest on how to test for that or continue.

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

Thanks very much!
Steve
 
Back
Top