Re: Application is closed during second synchronization
- From: "Michael Hotek" <mike@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 3 Jan 2006 12:06:43 -0600
Your schema versions do not match. If you reinitialize, it will clean this
up.
--
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Lonifasiko" <mloichate@xxxxxxxxx> wrote in message
news:1136285094.858729.123150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I've been able to start the Merge Agent from SQL Server 2005 Management
Studio. Agent runs correctly.
Some clarifications:
I use always Merge Replication.
My application initially checks if there is a local database
(downloaded before maybe); if there is, the synchronization is
asynchronous because we have data to play with.
If there is no database, I make a synchronous call with Synchronize()
method and wait. Then, I again have got data to play with. Next calls
will also be asynchronous.
This is the merge replication code I'm using. Really simple:
private void CheckReplicationStatus(object sender, EventArgs e)
{
if (true)
{
try
{
ConfigureReplicationManager();
if (replicationManager != null &&
systemCanReplicate)
{
replicationManager.HostName = userId;
// Check if the database file already exists
if
(!System.IO.File.Exists(Constants.DatabaseFilePath))
{
// Add a new subscripton and create the
local database file
replicationManager.AddSubscription(AddOption.CreateDatabase);
// La replicación inicial es
necesariamente síncrona ya que no existe la BD en local
replicationManager.Synchronize();
replicationManager.Dispose();
}
else
{
// Replicación asíncrona
IAsyncResult ar =
replicationManager.BeginSynchronize(new
AsyncCallback(SyncCompletedCallback), replicationManager);
}
}
else // No ha sido capaz de leer los ficheros de
configuración y no ha podido configurar la replicación
{
// La idea es ver si la BD existe en el
dispositivo --> Se le deja continuar ejecutando la aplicación
// pero se cancela la replicación. Pero no hay
manera ya que el path de la BD está también en los ficheros de
configuración
GeneralBehaviour.ShowErrorMessage(Properties.Resources.MasterForm_CannotReadConfigurationFiles);
Application.Exit();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToUpper());
replicationManager.Dispose();
GeneralBehaviour.ShowErrorMessage(Properties.Resources.MasterForm_InitialSynchronizationFailed);
// TODO: BORRAR LA BD YA QUE NO ES UNA BD OPERATIVA
Application.Exit();
}
}
}
/// <summary>
/// Evento que recoge los resultados de la sincronización
asíncrona
/// </summary>
/// <param name="ar"></param>
public void SyncCompletedCallback(IAsyncResult ar)
{
try
{
SqlCeReplication repl =
(SqlCeReplication)ar.AsyncState;
replicationManager = (SqlCeReplication)ar.AsyncState;
replicationManager.EndSynchronize(ar);
}
catch (SqlCeException exc)
{
// Fallo en la sincronización asíncrona --> La
aplicación sigue corriendo ya que tenemos BD en local
replicationManager.CancelSynchronize();
}
finally
{
replicationManager.Dispose();
}
}
This is all what I have Paul. Don't know what to do yet! It was working
and I'm spending my second day after a solution for this.
What do you think? Seems SQL Server's fault to me but cannot explain
why only fails second synchronization after first synchronization in
which I download all database.
Thanks for your time. Regards.
.
- References:
- Application is closed during second synchronization
- From: Lonifasiko
- Re: Application is closed during second synchronization
- From: Paul Ibison
- Re: Application is closed during second synchronization
- From: Lonifasiko
- Re: Application is closed during second synchronization
- From: Paul Ibison
- Re: Application is closed during second synchronization
- From: Lonifasiko
- Application is closed during second synchronization
- Prev by Date: Re: newbie: how-to start a transactionnal replication ?
- Next by Date: Re: Invalid object name 'sysmergearticles'.
- Previous by thread: Re: Application is closed during second synchronization
- Next by thread: Re: Filter clause
- Index(es):
Relevant Pages
|