.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

prevent infinte loop in replication

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :Sql Server


I have 2 servers x and y i created 4publications 2 of them  for insert from x->y and y->x

and 2 for update from x->y and y->x but in the update Publication  the articles added contains the same tables so when i update something

on x it replicates to y then y replicates it to x and this loops continues i want to prevent it.  

How can i reslove this conflict

View Complete Post

More Related Resource Links

The best way to prevent an agent job to run in the middle of a merge replication.



I would like to configure a SQL agent job such that it doesn’t run in the middle of merge replication synchronization. Means when a merge replication is taking place, the job have to wait, or just run again until merge replication is done.

What would be the best way to do this?

Thank you.

Merge Replication Infinite Loop & Time Problem


Hi all,

We have merge replication system between Sql Server 2008 R2 64bit Enterprise Edition (As a Publisher&Distributor) and Sql Server 2008 R2 Express Edition (As 800+ Subscribers). We use only "https " method as transfer method. We have 30 tables and we have Joins & Filters. Our system work normally for 5-6 months.

But for last 10 days, sometimes (generally initial snapshot being downloaded), it takes over 14 hours to replicate!! I think an infinite loop is being occured during the process. I trace the publication server with Sql Server Profiler 2008 and here is the trace file.

Lots of times, i see this line "exec sp_MSmergeupdatelastsyncinfo '8C01EA1F-153D-47BC-ACD3-F8439ACB7B76',2,N'Merge completed with no data changes processed .'" (and also other lines which repeat similar to this one) with same/different  Session ID's. And when i first see this line is after 3 seconds the start time of the Process!! And after , 6 seconds again same line, and after 13 seconds again same line and it goes on like this. I think, in fact synchronization process is finished after 5-6 seconds (normally because there is no any data change in fact!) but for some reason, it continues to same process over and over.

Is this a bug or anything else, h

Microsoft's Collaborative Application Markup Language (CAML) Loop

discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is:

for each loop



Need help in for each loop. i'm poor in for each loop. i wanna create a for each loop that can give me 2 value in each rows.

i create a for loop.. but is a mulitple rows. Anyone can help ?

here is my code.

Dim x As Integer, y As Double, x1 As Integer

        Dim d As Date, prevD As Date
        Dim d1 As TimeSpan

        temp_sec = ac.getTempTime(ddl_date.SelectedValue, ddl_id.SelectedValue)

        For I As Int32 = 0 To temp_sec.Tables(0).Rows.Count - 1
            If I Mod 1 = 0 Then
                ' To prevent list out of bounds
                If I + 1 < temp_sec.Tables(0).Rows.Count Then
                    d = temp_sec.Tables(0).Rows(I).Item(0)
                    prevD = temp_sec.Tables(0).Rows(I + 1).Item(0)
                    d1 = prevD - d
                    x = d1.TotalSeconds
                    x = x1 + x
                    y = temp_sec.Tables(0).Rows(I).Item(1)
                    list.Add(x, y)
                    x1 = x
                End If
            End If

Debug Leaky Apps: Identify And Prevent Memory Leaks In Managed Code


When is the .NET Garbage Collector unable to reclaim memory? The answer might surprise you. Stay tuned.

James Kovacs

MSDN Magazine January 2007

Prevent loading big images ..



i need to prevent loading big images e.g max 100KB

but i only store url

1. user put url with image (i remember this string in database not image itself)

this cause that i can not check image size before store url in database

because user can store url and after this operation put bigger file at that location)

2. my web page generate some different image based on first image

and i need to load portion of image 

to stream and set buffer size to 100KB + 1 Byte

if stream is larger than 100KB that user put bigger file 

how can i accomplish that?

FileStream can not use URI as location only disc location

what should i use instead?

please help,

Karol Bieniaszewski

Prevent Concurrent Logins ? [ Already logged in or currest session is still active implementation] ?


Hi Experts ,

I searched over the web but no luck so far and thought of getting some help form gurus .

Did any out really implemented a way to handle concurrent logins ?

Please not that i'm no using either forms authentication or Roles/Memberships , I do have custom authentication for my website .

I'm sure it is someway related  with global.asax file handling something in application events and session events but unable to figure this one out .

Any pointers will highly be valued and appreciated .

Thanks a tonne in advance .

how to write a stored proc to prevent multiple users in uploading the reports at a time? plsss help



I wanted to know how to prevent more than one user from uploading the report at a time .I am new to .net ,plss help with the code that would be great.Details are below:

This is a Windos based app written in c# . When User A  clicks Upload option on  one server  from the menu  to upload the files  and at the same time when User B clicks Upload option on different server , User B should be alerted a message saying "User A's uploading is in progress,pls wait" . How to achieve this, plsss help with the code.. I am thinking this logic should be kept in a stored proc, How do I write that proc? plss help


Thanks in advance!

How do I prevent displaying membership of an AD group in Colleague Tracker web part?


I'm a big fan of the Colleague Tracker web part in MOSS 2007 My Sites, especially the option to show 'Membership Changes'. This is often useful in highlighting that a colleague has been added to a certain AD group.

We now want to hide the membership of certain AD groups from the colleague tracker. For example, if an AD group called 'Project X' is created, we don't want membership of the group broadcast throughout the My Sites where colleagues are tracking colleagues.

My first thought was that we could use AD to 'deny read' on the 'Project X' AD group to all SharePoint related service accounts. This does not appear to have worked, although perhaps the configuration is more complex? The best approach would seem to be to prevent the group membership data ever being imported from AD to the SSP, hence my 'deny read' approach.

Has anyone successfully implemented this, or does anyone have any better ideas?


Loop for every record


Hi guys.

I've got a simple table with an ID, a NAME and an ARCHIVE booleen.

I want to write piece of code that goes through each record and...

If ARCHIVE is false and a folder hasn't been created for it, it will create it and go to the next record.

If ARCHIVE is false and a folder has been created for it, it will do nothing and go to the next record.

If ARCHIVE is true the whole folder will be moved to another folder and go to the next record.

When all records have been checked, the code will end.

I was thinking of using a SQL count to find out how many records there were and making a loop that starts at record one. runs the folder checking/creating/archiving code then +1 until the loop ends but I couldn't work out how to assign the query results to an integer...

I'm not asking for anyone to write the code. I think I probably already know 80% of the theory behind doing this I just can't glue it all together. I know you can do the folder stuff with the System.IO Directory Class...

Anyway, all input is welcome. Cheers guys!


How to detect and prevent new browser instance


Hi Folks,

I have a problem w/ a web app which is probably fairly common, but I cannot find any solutions anywhere. Hopefully someone will have an idea.

The web app in question provides a UI for editing a client (in the business sense, not the browser sense), identified by a ClientID.  I store the ClientID in Session, which gets passed from page to page, along with a number of other pieces of data in Session.  Works great.

The problem is that if the user opens a new browser window using Ctrl N or File->New Window (in IE), the new window comes up with the same page as the current page, with the same session info. Then if the user navigates to a different client in the 2nd window, the ClientID in session refers to the new client. If they go back to the original browser window and save, the original client gets saved using the 2nd ClientID, and all hell breaks loose, because now the data from the two jobs are intertwined.

I have enabled trace and verified that the new browser window uses the same SessionID as the original.  If an entirely new instance of IE is opened, it has a different SessionID, so is not a problem.  I have not yet investigated other browsers, such as Chrome or Firefox.

Is there any way to determine if a browser instance is opened for a web app which is already open in

Loop with DataReader


Hi.  I am having a really hard time with this code trying to loop through a datareader, and then enter the data into another table.  The logic is that I get 2 columns path and document_no from an Oracle Database.  I then need to check if the file in the path column is a valid path.  If it is not valid, it should be inserted into a SQL Server 2005 database.  My code is below, can anyone help?  I'm getting a headache from it.  If any further info is needed just let me know.  Thanks. 

Do While oraReader.Read()
                path1 = oraReader("Path")
                docno = oraReader("Document_No")
                If (System.IO.File.Exists(path1)) Then                    
                    sqlCmd = New SqlCommand("INSERT INTO CHECKLINKS1 (DOCUMENT_NO) VALUES (@doc)", conn)
                    sqlCmd.Parameters.AddWithValue("@doc", docno)
                End If


Combobox SelectionChanged: Prevent firing for every keystroke?

Is it possible for this event to fire only when the user clicks an item from combobox with the mouse or when they hit enter on it like the old 2.0 combobox worked? I have tried messing aroudn with the new selectionchanged event but I cannot figure it out. I looked on the forums here for help but only found someone returning the even to fire only when items they type are in the combobox. Thanks all help appreciated.GINtech Systems Owner

To prevent possible data loss before loading the designer, the following errors must be resolved: In

To prevent possible data loss before loading the designer, the following errors must be resolved: The class Form can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again. Instances of this error (1) 1. Hide Call Stack at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) Thanks! This post is from Matthew Cenance.

how to get current loop order number in "for each" ?

For Each item As pages.tbl1Row In pagesdim x as integerx = ?????response.write("current loop is :" & x )               Nextwhat code i need to replace with "?????" to get current loop order?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend