Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Tuesday, March 20, 2012

Changes to data not replicated

I have an application that uses web-based merge replication.My publisher is SQL 2005 and my subscriber is SQL 2005 Express.I control the replication with RMO code.If I make changes to the data in both databases using SQL Server Management Studio Express, my RMO code correctly syncs the two databases.However if I make changes to the data at the subscription through my application, these changes are not picked up by the replication process, even though the changes are present if you check the tables through Management Studio.What would cause these changes to not be recognized?Any ideas would be appreciated.

Hi there,

If you have changed the data in such a way as to stop the triggers from firing then these changes wouldn't be replicated.

This is normally associated with a bulk insert of data using something like a bulk insert but it doesn't sound like you are doing that.

To check if the triggers are firing you could check for the existence of the rowguids in MSMerge_Contents for the rows that you have changed.

|||

Merge replication uses triggers to track changes. First thing to check is if your updates are causing the triggers to fire and the transactions are commiting after updates. Is there any way for you to profile the updates made by your app? Do you know what DMLs your app uses to make the changes? If you can confirm that the triggers are firing then the next thing to check is if replication is picking up the changes. Are there any errors returned by replication? You can look at the replication log file for detailed errors. Replication log file is sqlmergx.log and its default location is %program files%\microsoft sql server\90\com.

thx

Sudarshan

|||

JR-J

Thanks for your resopnse.

I checked the MSmerge_Contents table after making changes to one of my application's tables. There was a row added when I made the changes from within Management Studio, but not when I made a similar change from within my application. So it looks as though my application doesn't cause the triggers to fire. The changes appear in the application's table in both cases.

I'm just using simple INSERT, UPDATE and DELETE statements in stored procedures in my application. No bulk inserts.

|||

Sudarshan,

Thanks for your resopnse.

I checked the MSmerge_Contents table after making changes to one of my application's data tables. There was a row added when I made the changes from within Management Studio, but not when I made a similar change from within my application. So it looks as though my application doesn't cause the triggers to fire. The changes appear in the application's table in both cases.

I'm just using simple INSERT, UPDATE and DELETE statements in stored procedures in my application. No bulk inserts.

I checked the log file you mentioned and it did not show any errors during merge. The merge picks up the data that is entered through Management Studio, but does not pick up the data I enter through my application.

Everything in the replication process except for this one problem, seems to be working as expected. We created the publication in Management Studio. I then create the subscription on the client using RMO, and also run the synchronization using RMO. This is my last hurdle in getting my application to work.

Are there any special security considerations you must consider for the triggers to work. I just seems to me that the INSERT statement from my stored procedures should cause the trigger to fire, just as entering data into the table in SQL Management Studio. I'm new to using triggers, so I may not be that good at understanding what they are doing behind the scenes.

|||

I am still having the same problem with not being able to sync the data entered through my application. I even created a new publication on a new SQL 2005 Server to ensure that the problem was not with the publication/server/permissions. I reproducibly get the same error mentioned in my original post. As this is the only step left in my development and deployment of this application, I am really stuck until I can solve this problem. Does anyone from Microsoft have and suggestions as to how to troubleshoot this issue. I'll bet that the soultion will be a simple comfiguration setting, or something like that, however, I don't have enough experience to know where to look. We also have several other applications that we hope to use replication on, if we can get this problem solved.

Thanks for any help.

|||

Ok so it's pretty clear that the triggers aren't firing for some reason.

Would it be possible for you to use profiler against your database whilst running the app and any of the logs event viewer/sql logs/ merge agent logs?

It might also be worth while ensuring that the triggers are infact in place. If you script out your tables you should see some triggers that look like this attached to the tables that are participating in replication msmerge_ins_<GUID>, msmerge_upd_<GUID>, msmerge_del_<GUID>.

Cheers, James

|||I tried installing profiler on the computer which runs SQL Express 2005, but the install would not allow me to because Express is installed. The triggers are on all of the tables, and they work, as the data I enter directly into the table through Management Studio Express is correctly merged. Its just that for some reason, the triggers either don't fire, or don't operate correctly when I add data to the same tables from my application. The application is a VB.NET application and uses stored procedures which INSERT, UPDATE and DELETE data in the SQL 2005 Express database. All of the stored procedures are working as expected. I'll see if I can attach profiler to my SQL Express database from another server.|||

yes sorry I forgot you had run the inserts etc manually.

if you have the normal client tools elsewhere hopefully you'll be able to connect across using profiler. I assume there are no error messages in the logs for your issues.

Cheers, James

|||

James,

I was unable to get profiler to connect to my subscriber database.

|||

Just a thought.

Do the row GUIDs need to be named RowGUID in each table. My row GUIDs are named according to the subject of the table, but then marked as a row GUID in the column's properties. This must not make a difference, as the triggers seem to work as expected in Management Studio.

Does anyone know if the Table Adapter's in Visual Studio require any special setup to allow the triggers to fire from within the application. I use DataSets/Table Adapters to design my Queries and Data Access Layer.

|||

No they don't need to be named rowguid in order for everything to work.

What problems are you experiencing connecting profiler to your subscriber?

Sorry I don't know anything about Table adaptors so I'll have to leave that to someone else.

|||

I found the problem.

In Visual Studio you must create a connection string to connect to the databases in your application. One of the advanced features of the connection is a parameter called Replication. It has values of True and False. It was set to True, which seemed logical, since I wanted to do replication of the database. However, True means that the application is recognized as a replication agent. Replication triggers do not fire for replication agents. I set the value to false, and now everything works as expected.

Thanks for your help.

sql

Monday, March 19, 2012

changeing Dataflow tasks propeties by coding

Hi,
Is it possible to change the Dataflow tasks properties with VB coding? I've managed to change the properties of the control Flow tasks with VB code! as I wan to create a generic dataflow that will change everytime I run it.
CheersYes, you can. It is a bit more complicated, as many of the properties are contained in a CustomProperties collection on the data flow objects, so you need to find the names of the specific properties that you are interested in.|||

Kolf wrote:

Hi,
Is it possible to change the Dataflow tasks properties with VB coding? I've managed to change the properties of the control Flow tasks with VB code! as I wan to create a generic dataflow that will change everytime I run it.
Cheers

Kolf,

You know that you cannot change this stuff while the package is running right? You need to affect the change prior to the package running.

-Jamie

|||would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks|||

Kolf wrote:

would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks

This is quite a big area and I don't know of one example that covers everything. What in particular are you having trouble with? Navigating through the package to the property or knowing how to change it?

-Jamie

|||Thanks again Jamie, you've been very helpful

So there is no escape or work around this issue. I was hoping instead on using Transfer SQL Server object task (to copy the table to destination server, which dynamic tablelist feed – and using sub-package ), I could use dataflow tasks within one package (and avoid using sub-package and changing the property of the sub-package from parent package – as this is how it works now and it’s very slow) .

So I can use execute sql task to populate the table schema on the destination and then use a dataflowtask to push the data across , all in one package. And be able to put this in a loop to do for a list of tables.

I hope I’ve explained it clearly

|||

Kolf wrote:

would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks

Kolf,

Jessica Elise has posted some great code here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1404157&SiteID=1&mode=1 that may be of use.

-Jamie

changeing Dataflow tasks propeties by coding

Hi,
Is it possible to change the Dataflow tasks properties with VB coding? I've managed to change the properties of the control Flow tasks with VB code! as I wan to create a generic dataflow that will change everytime I run it.
Cheers

Yes, you can. It is a bit more complicated, as many of the properties are contained in a CustomProperties collection on the data flow objects, so you need to find the names of the specific properties that you are interested in.|||

Kolf wrote:

Hi,
Is it possible to change the Dataflow tasks properties with VB coding? I've managed to change the properties of the control Flow tasks with VB code! as I wan to create a generic dataflow that will change everytime I run it.
Cheers

Kolf,

You know that you cannot change this stuff while the package is running right? You need to affect the change prior to the package running.

-Jamie

|||would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks
|||

Kolf wrote:

would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks

This is quite a big area and I don't know of one example that covers everything. What in particular are you having trouble with? Navigating through the package to the property or knowing how to change it?

-Jamie

|||Thanks again Jamie, you've been very helpful

So there is no escape or work around this issue. I was hoping instead on using Transfer SQL Server object task (to copy the table to destination server, which dynamic tablelist feed – and using sub-package ), I could use dataflow tasks within one package (and avoid using sub-package and changing the property of the sub-package from parent package – as this is how it works now and it’s very slow) .

So I can use execute sql task to populate the table schema on the destination and then use a dataflowtask to push the data across , all in one package. And be able to put this in a loop to do for a list of tables.

I hope I’ve explained it clearly

|||

Kolf wrote:

would you be able to give me on example so it will keep me going, yes and I am aware of the issue that I need to change the properties prior to running the package. therefore it dataflow should be in a sub-package.
Thanks

Kolf,

Jessica Elise has posted some great code here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1404157&SiteID=1&mode=1 that may be of use.

-Jamie

Friday, February 24, 2012

Change SQL (order by) at runtime?

I'm creating a fairly simple report using the ReportViewer control in
a Windows app. I have credentials and everything working, but I want
to change the SQL at run time. The dataset in the designer has this
SQL:
Select * from CPS.Main Order By Docket
Easy enough, but how can I replace that Docket with something at
runtime. I tried
Select * from CPS.Main Order By ?
and passed in a parameter. It runs, but ignores the Order By.
Am I going about this the wrong way? It's an ODBC database, not
SQLServer if that matters.First, one option for you is to allow the user to sort as they want. User
sortable columns is availabe starting in RS 2005.
Otherwise, what you want to do is to set the data source as an expression.
You are creating a string that equates to the SQL you want.
= "Select * from CPS.Main Order By " & Parameters.MyParam.Value
Be sure you have the field list you want because once you switch to this you
will not get a field list refreshed.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"dgk" <dgk@.somewhere.com> wrote in message
news:rcggs31e1ni0a29noueeetlud5qugmguko@.4ax.com...
> I'm creating a fairly simple report using the ReportViewer control in
> a Windows app. I have credentials and everything working, but I want
> to change the SQL at run time. The dataset in the designer has this
> SQL:
> Select * from CPS.Main Order By Docket
> Easy enough, but how can I replace that Docket with something at
> runtime. I tried
> Select * from CPS.Main Order By ?
> and passed in a parameter. It runs, but ignores the Order By.
>
> Am I going about this the wrong way? It's an ODBC database, not
> SQLServer if that matters.|||On Fri, 29 Feb 2008 12:14:12 -0600, "Bruce L-C [MVP]"
<bruce_lcNOSPAM@.hotmail.com> wrote:
>First, one option for you is to allow the user to sort as they want. User
>sortable columns is availabe starting in RS 2005.
>Otherwise, what you want to do is to set the data source as an expression.
>You are creating a string that equates to the SQL you want.
>= "Select * from CPS.Main Order By " & Parameters.MyParam.Value
>Be sure you have the field list you want because once you switch to this you
>will not get a field list refreshed.
Not option one, each page is a separate law case, the Order By will be
putting those pages in some sort of order.
I was about to tell you that your second approach doesn't work,
because the red ! in the data tab of the designer (VS2005) is greyed
out, but it does work when switching to the Preview tab.
Thanks, problem solved.|||I should have said you don't get a field list AND you can't execute from the
dataset tab.
But, you figured that out yourself.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"dgk" <dgk@.somewhere.com> wrote in message
news:53lgs3l06d1gkp5k2cgrul7c16dq7kam80@.4ax.com...
> On Fri, 29 Feb 2008 12:14:12 -0600, "Bruce L-C [MVP]"
> <bruce_lcNOSPAM@.hotmail.com> wrote:
>>First, one option for you is to allow the user to sort as they want. User
>>sortable columns is availabe starting in RS 2005.
>>Otherwise, what you want to do is to set the data source as an expression.
>>You are creating a string that equates to the SQL you want.
>>= "Select * from CPS.Main Order By " & Parameters.MyParam.Value
>>Be sure you have the field list you want because once you switch to this
>>you
>>will not get a field list refreshed.
>
> Not option one, each page is a separate law case, the Order By will be
> putting those pages in some sort of order.
> I was about to tell you that your second approach doesn't work,
> because the red ! in the data tab of the designer (VS2005) is greyed
> out, but it does work when switching to the Preview tab.
> Thanks, problem solved.
>

Thursday, February 16, 2012

Change query of report in reportviewer

Hi,

I have a reporting services report that i show in an asp.net page by a reportviewer control.

Is there a property that i can set in my asp.net page, to change the query for changing the data in my report.

The number and names of the columns will be the same.

I should work with parameters, but the query changes more than just a few where-clauses. So i think working with parameters looks impossible.

Thanks,

Dennis

Hi,

using parameters is the only way to accomplish it. You can use a stored procedure in conjunction with a parameter which decicde within your stored procedue code which query to execute.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Excuse me

How Can I do a clr routine with a call to crystal report?

Thanks

Change query of report in reportviewer

Hi,

I have a reporting services report that i show in an asp.net page by a reportviewer control.

Is there a property that i can set in my asp.net page, to change the query for changing the data in my report.

The number and names of the columns will be the same.

I should work with parameters, but the query changes more than just a few where-clauses. So i think working with parameters looks impossible.

Thanks,

Dennis

Hi,

using parameters is the only way to accomplish it. You can use a stored procedure in conjunction with a parameter which decicde within your stored procedue code which query to execute.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Excuse me

How Can I do a clr routine with a call to crystal report?

Thanks