Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

modfather

MIS
Feb 15, 2000
75
US

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 pc user 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top