Merge Replication/SQL Server CE/Pocket PC

  • First things first: I apologize for posting a problem that borders on VB.NET and SQL Server CE in this forum, but didn't know where else to post it.

    I'm a newbie to VB.NET (somewhat) and SQL Server CE, 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. This problem occurs when I run the application against my PPC emulator. 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

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply