Saturday, February 25, 2012
Custom Conflict Viewer
1. I am using MSDE
2. I would like to have more control over what is shown to the user
3. The application may store attachments in image fields (say they are
Excel spreadsheets), the user would like to view the content of the winning
and losing image fields (and see the spreadsheets) before they make a
decision on which would they want to keep.
Does anyone know what is the best way to go about it?
To get information on conflicts, it seems that I need to use the
following sprocs:
sp_helpmergearticleconflicts
sp_helpmergeconflictrows
sp_helpmergedeleteconflictrows
After I have this information, it seems that I need to get the table at
the publisher (I am using the default conflict resolver so the publisher
always win when I run the Merge agent) and its equivalent conflict table and
display them to the user (after some formatting). Am I on the right track?
Are there stored procedures or views to get the conflict table or do I just
reference it directly? Are there stored procedures to manipulate the
conflict table (so the conflict can be deleted after resolution).
Are there any libraries or controls out there that would accomplish
something similar?
Thank you,
Maer
the SQL 2000 resource kit is a good start. They have a chapter devoted to
this.
You can also examine the Microsoft SQL Replication Conflict Resolver
Library.
"Maer" <maer@.auditleverage.com> wrote in message
news:O1AjILFuEHA.4040@.TK2MSFTNGP09.phx.gbl...
> Hi -I would like to create my own conflict viewer for a few reasons:
> 1. I am using MSDE
> 2. I would like to have more control over what is shown to the user
> 3. The application may store attachments in image fields (say they are
> Excel spreadsheets), the user would like to view the content of the
winning
> and losing image fields (and see the spreadsheets) before they make a
> decision on which would they want to keep.
> Does anyone know what is the best way to go about it?
> To get information on conflicts, it seems that I need to use the
> following sprocs:
> sp_helpmergearticleconflicts
> sp_helpmergeconflictrows
> sp_helpmergedeleteconflictrows
> After I have this information, it seems that I need to get the table
at
> the publisher (I am using the default conflict resolver so the publisher
> always win when I run the Merge agent) and its equivalent conflict table
and
> display them to the user (after some formatting). Am I on the right track?
> Are there stored procedures or views to get the conflict table or do I
just
> reference it directly? Are there stored procedures to manipulate the
> conflict table (so the conflict can be deleted after resolution).
> Are there any libraries or controls out there that would accomplish
> something similar?
> Thank you,
> Maer
>
|||Thank you. However, I don't want to create a custom resolver since the
ones that come with SQL Server are sufficient for us. What I want is to
create a Conflict Viewer so that after merging has taken place and winners
and losers have been chosen, the user can go there and make changes (to
override the decision if necessary).
I took a look at the chapter and it didn't seem to cover the Conflict
Viewer itself. Please let me know if I should have looked elsewhere.
Thank you for your assistance - Maer
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:uaQ$h6FuEHA.1296@.TK2MSFTNGP10.phx.gbl...
> the SQL 2000 resource kit is a good start. They have a chapter devoted to
> this.
> You can also examine the Microsoft SQL Replication Conflict Resolver
> Library.
> "Maer" <maer@.auditleverage.com> wrote in message
> news:O1AjILFuEHA.4040@.TK2MSFTNGP09.phx.gbl...
> winning
> at
> and
> just
>
|||Dang it! How did I misread your post so badly and completely?
There is a conflict viewer class as well. I can't locate it at the moment,
when I find it, I'll post it here.
"Maer" <maer@.auditleverage.com> wrote in message
news:%23CtYEyIuEHA.4040@.TK2MSFTNGP09.phx.gbl...
> Thank you. However, I don't want to create a custom resolver since the
> ones that come with SQL Server are sufficient for us. What I want is to
> create a Conflict Viewer so that after merging has taken place and winners
> and losers have been chosen, the user can go there and make changes (to
> override the decision if necessary).
> I took a look at the chapter and it didn't seem to cover the Conflict
> Viewer itself. Please let me know if I should have looked elsewhere.
> Thank you for your assistance - Maer
>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:uaQ$h6FuEHA.1296@.TK2MSFTNGP10.phx.gbl...
>
|||Library CnfViewer
C:\Program Files\Common Files\Microsoft Shared\Database
Replication\WZCNF.dll
Replication Conflict Viewer
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%23uTP0cJuEHA.3460@.TK2MSFTNGP15.phx.gbl...[vbcol=seagreen]
> Dang it! How did I misread your post so badly and completely?
> There is a conflict viewer class as well. I can't locate it at the moment,
> when I find it, I'll post it here.
> "Maer" <maer@.auditleverage.com> wrote in message
> news:%23CtYEyIuEHA.4040@.TK2MSFTNGP09.phx.gbl...
the[vbcol=seagreen]
winners[vbcol=seagreen]
to[vbcol=seagreen]
reasons:[vbcol=seagreen]
user[vbcol=seagreen]
table[vbcol=seagreen]
publisher[vbcol=seagreen]
table[vbcol=seagreen]
accomplish
>
Custom conflict resolver example code in C#
I'm trying to create a custom conflict resolver for SQL Server 2000 in
C# but i can't seem to find any source code examples of a *.dll where i
can actually see what needs to be done.
Any help is welcome.
Thanks
In SQL 2000, you can only do this in VB, C# isn't supported. However in SQL 2005, you can definitely use C#.
|||Thanks,so that's why i couldn't find anything in C# :/
Going to try and find a different approach then.
Custom conflict resolver example code in C#
I'm trying to create a custom conflict resolver for SQL Server 2000 in
C# but i can't seem to find any source code examples of a *.dll where i
can actually see what needs to be done.
Any help is welcome.
Thanks
In SQL 2000, you can only do this in VB, C# isn't supported. However in SQL 2005, you can definitely use C#.
|||Thanks,so that's why i couldn't find anything in C# :/
Going to try and find a different approach then.
Custom Conflict Resolver
Hi there,
I have created a custom conflict resolver for an article that is using Merge replication. I can register my custom resolver OK, I can change my merge article to use my new custom resolver, but when a conflict occures the replication monitor shows the following errors:
Error messages:
No signature was present in the subject.
(Source: MSSQL_REPL, Error number: MSSQL_REPL-2146762496)
Get help: http://help/MSSQL_REPL-2146762496
The Custom Resolver Component for article 'BRANCH' does not have a valid digital signature. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147198713)
Get help: http://help/MSSQL_REPL-2147198713
At first I thought it was because my assembly wasn't signed, so I signed it. I still get the same error.
I have various debug statements in the assembly and I can see that Initialize and HandleChangeStates gets called ok, but no other overrides.
Can anyone help me please?
Thanks
Graham
Hi Graham
When you added the article with sp_addmergearticle did you want the the signature verified?
[@.verify_resolver_signature = ] verify_resolver_signature
Specifies if a digital signature is verified before using a resolver in merge replication. verify_resolver_signature is int, with a default of 0. 0 specifies that the signature will not be verified. 1 specifies that the signature will be verified to see if it is from a trusted source.
See here for more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_repl_11et.asp
Thanks
Nabila Lacey
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi there Gravy, i'm new in merge replication, conflict resolution, procedures and more.I managed to make a replication from a PC to a PPC, and it works, but now i have conflicts updating colums, i never worked with procedures, and i'll have to do one to problaby solve my conflict cause i think i dont need any of the com based resolvers.
Could you explain me how i do a procedure to conflict resolver? if possible the steps, how can i get the publisher table and subscriber table with conflicts, ao can i make some calculations with them and put in the final column to be correct values.
If your could give me some procedure example, or your example, i would be greatfull.
I've read lots of Book online and foruns, and ive not discovered nothing that i need, but i think maybe you could help me.
Thanks in advance
Custom Conflict Resolver
Hi there,
I have created a custom conflict resolver for an article that is using Merge replication. I can register my custom resolver OK, I can change my merge article to use my new custom resolver, but when a conflict occures the replication monitor shows the following errors:
Error messages:
No signature was present in the subject.
(Source: MSSQL_REPL, Error number: MSSQL_REPL-2146762496)
Get help: http://help/MSSQL_REPL-2146762496
The Custom Resolver Component for article 'BRANCH' does not have a valid digital signature. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147198713)
Get help: http://help/MSSQL_REPL-2147198713
At first I thought it was because my assembly wasn't signed, so I signed it. I still get the same error.
I have various debug statements in the assembly and I can see that Initialize and HandleChangeStates gets called ok, but no other overrides.
Can anyone help me please?
Thanks
Graham
Hi Graham
When you added the article with sp_addmergearticle did you want the the signature verified?
[@.verify_resolver_signature = ] verify_resolver_signature
Specifies if a digital signature is verified before using a resolver in merge replication. verify_resolver_signature is int, with a default of 0. 0 specifies that the signature will not be verified. 1 specifies that the signature will be verified to see if it is from a trusted source.
See here for more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_repl_11et.asp
Thanks
Nabila Lacey
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi there Gravy, i'm new in merge replication, conflict resolution, procedures and more.I managed to make a replication from a PC to a PPC, and it works, but now i have conflicts updating colums, i never worked with procedures, and i'll have to do one to problaby solve my conflict cause i think i dont need any of the com based resolvers.
Could you explain me how i do a procedure to conflict resolver? if possible the steps, how can i get the publisher table and subscriber table with conflicts, ao can i make some calculations with them and put in the final column to be correct values.
If your could give me some procedure example, or your example, i would be greatfull.
I've read lots of Book online and foruns, and ive not discovered nothing that i need, but i think maybe you could help me.
Thanks in advance
Custom Conflict Resolver
I'm using a custom conflict resolver (using stored procedure) for one of any
articles.
I want to determine which columns were in conflict in this stored procedure.
Could you pls point me to some pointers on how to achieve the same.
Thanking you.....
I don't believe this can be done. If you are using column level tracking you
might be able to parse the message returned.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Pinkesh" <Pinkesh@.discussions.microsoft.com> wrote in message
news:9E9B4BA9-BCCF-4FE6-8EE4-C5A506B87E73@.microsoft.com...
> Hi All,
> I'm using a custom conflict resolver (using stored procedure) for one of
any
> articles.
> I want to determine which columns were in conflict in this stored
procedure.
> Could you pls point me to some pointers on how to achieve the same.
> Thanking you.....
>
>
|||Hi Hilary,
Thanks for the prompyt reply.
I'm using Column level tracking for my publication.
Sorry but I didn't understand what you mean by "parse the message returned".
Could you pls help by providing some details regarding it.
Thanking you.
"Hilary Cotter" wrote:
> I don't believe this can be done. If you are using column level tracking you
> might be able to parse the message returned.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "Pinkesh" <Pinkesh@.discussions.microsoft.com> wrote in message
> news:9E9B4BA9-BCCF-4FE6-8EE4-C5A506B87E73@.microsoft.com...
> any
> procedure.
>
>
Custom Conflict Resolution Question
I have to setup custom conflict resolution so that the
most recent update wins using a column 'lasteditdate' in a
a merge replication scenario and have about 150 tables to
do this on. Do I have to configure each table/article
individually or can I do all necessary tables in one shot?
Any help would be greatly appreciated!
Thanks in advance
Gene,
each one has to be done separately. However, you could create the
publication in SQLDMO then loop round the tables if you want a more
efficient way of doing it.
HTH,
Paul Ibison
Custom conflict resolution problem
I
am doing a work were i have to syncronize data between a Publiser
(PC, SQL SERVER 2005), and a subscriber (Pocket PC, SQL CE MOBILE). I
studied lots of articles and i managed to put the syncronization to
work, the problem is in conflict resolution!
The subscriber can′t insert or delet, only update!!
For exmple: I have a table that contais the quantity of a product X,
for example 100 units, this goes to Pocket, but later arrive move 100
units that are increased in the PC, so we get 200 in the PC, (but 100
in Pocket), no problem if i syncronize now (Pocket will have 200 too),
but if remove in Pocket for example 50 units, i've changed the same
column in both Publisher and Subscriber database, if i syncronize now,
i'll have a conflict, the final result should be 150 of product X in
both databases (100 + 100 - 50), but the Publisher wins the conflict
and the final result is 200!
I never worked with stored procedures and in microsoft theres and article called How to: Implement a Stored Procedure-Based Custom Conflict Resolver for a Merge Article (Replication Transact-SQL Programming), but they dont explain it very well and i dont know how to do my own stored procedure and implement it to the merge article.
in my own stored procedure i'll have to do some calculations to get the
result i want, maybe using some table for the additions and
subtractions. (Does the com based Addition resolver do this for me?)
Maybe you have experienced some problem like this, and could help me!
How should i do the stored procedure?
Oh, i tried to use de addiction resolver and the average resolver
of com based but nothing happed, dont know why, i read some stuff and
i think the addition could solve my problem, but it doesn′t work, i read above what you said and installed service
pack 1 for sql 2005, but i instaled and nothing
happened!
When i change to the resolver that the subscriver wins, it works, why addition dont work?
Thanx
JohnCP, forget about the conflict resolvers for now, the question I have is regarding how you're creating your conflict. Please explain to me again the series of steps you took, is it:
1. delete 50 rows from pocket pc
2. update column at publisher
3. update column at subscriber
Is this correct? I cannot understand why you still have 200 rows existing, can you further explain?
|||I split your post, please refrain from posting your same question to multiple threads.
Regarding custom resolver, you most likely will have to create your own custom COM resolver to resolve this type of an issue.
|||Hi Greg, thx for the answersI solve the problem with business logic handlers.
Here is the code, maybe it could help more ppl
public class Class1 : Microsoft.SqlServer.Replication.BusinessLogicSupport.BusinessLogicModule
{
// Variables to hold server names.
private string publisherName;
private string subscriberName;
// Implement the Initialize method to get publication
// and subscription information.
public override void Initialize(string publisher, string subscriber, string distributor,
string publisherDB, string subscriberDB, string articleName)
{
// Set the Publisher and Subscriber names.
publisherName = publisher;
subscriberName = subscriber;
}
// Declare what types of row changes, conflicts, or errors to handle.
override public ChangeStates HandledChangeStates
{
get
{
// Handle Subscriber inserts, updates and deletes.
return ChangeStates.UpdateConflicts |
ChangeStates.SubscriberUpdates | ChangeStates.PublisherUpdates;
}
}
//Treats update conflict
public override ActionOnUpdateConflict UpdateConflictsHandler(
DataSet publisherDataSet,
DataSet subscriberDataSet,
ref DataSet customDataSet,
ref ConflictLogType conflictLogType,
ref string customConflictMessage,
ref int historyLogLevel,
ref string historyLogMessage
)
{
//copies publisher dataset to customdataset
customDataSet = publisherDataSet.Copy();
//Quantity of the Publisher
int qPub = Int32.Parse(publisherDataSet.Tables[0].Rows[0]["Quantity "].ToString());
//Quantity of the Subscriber to Add to Publisher
int qSubA = Int32.Parse(subscriberDataSet.Tables[0].Rows[0]["AddToPub"].ToString());
//Quantity of the Subscriber to subtract to Publisher
int qSubS = Int32.Parse(subscriberDataSet.Tables[0].Rows[0]["SubToPub"].ToString());
int qFinal = qPub + (qSubA - qSubS);
//Insert final values in customDataSet that will be the data in both Pub and Subscriber
customDataSet.Tables[0].Rows[0]["Quantity "] = qFinal;
customDataSet.Tables[0].Rows[0]["AddToPub"] = 0;
customDataSet.Tables[0].Rows[0]["SubToPub"] = 0;
return ActionOnUpdateConflict.AcceptCustomConflictData;
}
//Treats normal update without conflict
public override ActionOnDataChange UpdateHandler(SourceIdentifier updateSource,
DataSet updatedDataSet, ref DataSet customDataSet, ref int historyLogLevel,
ref string historyLogMessage)
{
//if it's subscriber doing update -clean columns AddToPub, SubToPub
//to avoid errors
if (updateSource == SourceIdentifier.SourceIsSubscriber)
{
//copies dataset thats being updated to customdataset, where i'll make changes and return it
customDataSet = updatedDataSet.Copy();
//Insert final values in customDataSet that will be the data in both Pub and Subscriber
customDataSet.Tables[0].Rows[0]["AadicionarAPub"] = 0;
customDataSet.Tables[0].Rows[0]["AsubtrairAPub"] = 0;
// Accept the updated data in the Subscriber's data set and apply it to the Publisher.
return ActionOnDataChange.AcceptCustomData;
}
else
{
return base.UpdateHandler(updateSource, updatedDataSet,
ref customDataSet, ref historyLogLevel, ref historyLogMessage);
}
}