|
|
|
date: Tue, 28 Jun 2005 12:47:02 -0700,
group: microsoft.public.sqlserver.ce
back
Re: SQL Mobile Exception when Replicating
I think I have more specific information regarding this error. One of the
screens has a datagrid in the top section of the screen that is populated by
a dataset, and based on the selection in that datagrid, a second details
datagrid is populated in the lower section of the screen.
The error would only occur if I clicked on an option in the upper datagrid
that actually returned details in the lower datagrid. Further investigation
revealed that the error is actually being thrown when the SqlCeReplication
object was being instantiated, but apparently only after making triggering
the code that populated the lower dataset.
If the SqlCeReplication object is instantiated before all the calls, the DLL
in the error is apparently loaded without a problem, and the app seems to be
very happy after that. This would be consistent with the observed behaviour
that if I did a replication before calling the lower dataset code the
SqlCeReplication object was also instantiated during that process and so then
calling the code did not cause the crash.
The results were consistent, everytime I loaded the app, if I populated the
lower dataset before a replication the SqlCeReplication object instantiation
threw an error, if I instantiated it first and then populated the lower
datagrid it was happy.
If it isn't a bug, perhaps you could help me understand what is actually
happening. Here is the code that initiates replication:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlServerCe;
using System.Windows.Forms;
using System.IO;
namespace FunBunny
{
class fbreplication
{
private Boolean fbsyncing = false;
private fbdbconn fbconnectionstring = null;
private string fbsyncstatusmsg = "";
public fbreplication()
{
fbconnectionstring = new fbdbconn();
}
public void fbsyncinvisible()
{
fbsync("JohnDoe", "anonymous");
}
public void fbsync(string fbusernamelocal, string fbpasswordlocal)
{
if (fbsyncing == false)
{
fbsyncing = true;
SqlCeReplication fbrepl = null;
try
{
Cursor.Current = Cursors.WaitCursor;
fbrepl = new SqlCeReplication();
fbrepl.ConnectionManager = true;
fbrepl.PublisherSecurityMode =
SecurityType.NTAuthentication;
fbrepl.HostName = fbusernamelocal;
fbrepl.Publisher = "Publisher";
fbrepl.InternetUrl =
"https://fb.url.net/sqlce/sqlcesa30.dll";
fbrepl.InternetLogin = fbusernamelocal;
fbrepl.InternetPassword = fbpasswordlocal;
fbrepl.Subscriber = fbusernamelocal;
fbrepl.Publication = "Publication";
fbrepl.PublisherDatabase = "Publication";
fbrepl.SubscriberConnectionString =
fbconnectionstring.getconnectionstring();
fbrepl.CompressionLevel = 3;
fbrepl.ConnectionRetryTimeout = 180;
fbrepl.Validate = ValidateType.RowCountOnly;
if
(System.IO.File.Exists(fbconnectionstring.getdblocation()) == false)
{
SqlCeEngine fbcreatedb = new
SqlCeEngine(fbconnectionstring.getcreatedb().ToString());
fbcreatedb.CreateDatabase();
fbrepl.AddSubscription(AddOption.ExistingDatabase);
}
fbrepl.Synchronize();
fbsyncstatusmsg = "Synchronization Complete: " +
"\nChanges Retrieved: " +
fbrepl.PublisherChanges.ToString() +
"\nChanges Sent: " +
fbrepl.SubscriberChanges.ToString();
MessageBox.Show(fbsyncstatusmsg, "Sychronization
Results", MessageBoxButtons.OK, MessageBoxIcon.Asterisk,
MessageBoxDefaultButton.Button1);
}
catch (SqlCeException SQLEx)
{
MessageBox.Show("A SQL Mobile Exception has occured
while attempting to sync FunBunny. Please wait a few minutes and attempt to
sync again.\n\nSQL Mobile Exception Details:\n\n" + SQLEx.Message);
}
catch (Exception ExMsg)
{
MessageBox.Show("A General Exception has occured while
attempting to sync FunBunny. Please wait a few minutes and attempt to sync
again.\n\nGeneral Exception Details:\n\n" + ExMsg.Message);
}
finally
{
fbrepl.Dispose();
Cursor.Current = Cursors.Default;
}
}
}
}
}
"Darren Shaffer" wrote:
> Could you post the code you are using to initiate replication
> from your mobile app? I've done a couple of CF2.0 apps
> that replicate SQLMobile to SQL Server and have not had
> any issues.
> --
> Darren Shaffer
> ..NET Compact Framework MVP
> Principal Architect
> Connected Innovation
> www.connectedinnovation.com
>
> "Go Mobile" wrote in message
> news:01982090-272A-43B5-81AA-6B014797752B@microsoft.com...
> >I am writing an application in VS2005 Beta 2 with SQL Mobile 2005. Upon
> > initial load of the application, replication to the SLQ 2000 SP4 server
> > functions just fine.
> >
> > If I move around the application a bit, about 4 forms into it, then come
> > back to the screen with the menu option that triggers replication, I get a
> > SQL Mobile Exception with the following:
> >
> > "A SQL Mobile DLL could not be loaded. Reinstall SQL Mobile. [DLL Name =
> > sqlceca30.dll,DIR Name= ]". I do recognize the DLL name, but I know it
> > from
> > the IIS component. Does anyone know why this error is occuring, and if
> > so,
> > how to overcome it?
>
>
>
date: Wed, 29 Jun 2005 08:10:14 -0700
author: Go Mobile
|
|