Showing posts with label updating. Show all posts
Showing posts with label updating. Show all posts

Wednesday, March 7, 2012

Exception while updating NS instance through code

Hi,

I am trying to add subscription classes through code. While updating the instance it throws following exception.

Microsoft.SqlServer.Management.Smo.SmoException: The Notification Services operation performed is invalid. > System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. > Microsoft.SqlServer.NotificationServices.NSException: An attempt to run a Transact-SQL CREATE TABLE statement failed.

I don't know which table is being created on updating this instance. Does it sound to be a permission problem?

SubscriptionClass myClass = new SubscriptionClass(nmoApplication, "Publication0");
myClass.FileGroup = "DEFAULT";

......................................
......................................
......................................

SubscriptionField salesAmountRate = new nmo.SubscriptionField(myClass, "SalesAmountRate ");
salesAmountRate .Type = "tinyint";
salesAmountRate .TypeModifier = "not null";
myClass.SubscriptionFields.Add(salesAmountRate );

.........................................
.........................................
.........................................

myClass.SubscriptionEventRules.Add(eventRule);

myClass.SubscriptionScheduledRules.Add(scheduledRule);

nmoApplication.SubscriptionClasses.Add(myClass);

nmoInstance.Disable();

nmoInstance.Update();

nmoInstance.Enable();

Could be a permissions problem. How are you connecting to the database? What db roles are your user associated with?

Also check to see if the table (or another table named Publication0Old) already exists.

HTH...

Joe

Exception while updating NS instance through code

Hi,

I am trying to add subscription classes through code. While updating the instance it throws following exception.

Microsoft.SqlServer.Management.Smo.SmoException: The Notification Services operation performed is invalid. > System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. > Microsoft.SqlServer.NotificationServices.NSException: An attempt to run a Transact-SQL CREATE TABLE statement failed.

I don't know which table is being created on updating this instance. Does it sound to be a permission problem?

SubscriptionClass myClass = new SubscriptionClass(nmoApplication, "Publication0");
myClass.FileGroup = "DEFAULT";

......................................
......................................
......................................

SubscriptionField salesAmountRate = new nmo.SubscriptionField(myClass, "SalesAmountRate ");
salesAmountRate .Type = "tinyint";
salesAmountRate .TypeModifier = "not null";
myClass.SubscriptionFields.Add(salesAmountRate );

.........................................
.........................................
.........................................

myClass.SubscriptionEventRules.Add(eventRule);

myClass.SubscriptionScheduledRules.Add(scheduledRule);

nmoApplication.SubscriptionClasses.Add(myClass);

nmoInstance.Disable();

nmoInstance.Update();

nmoInstance.Enable();

Could be a permissions problem. How are you connecting to the database? What db roles are your user associated with?

Also check to see if the table (or another table named Publication0Old) already exists.

HTH...

Joe

Wednesday, February 15, 2012

Excel headers - using SimplePageHeaders deviceinfo setting

I want to try out placing the report header in the Excel page header instead of the worksheet. I have seen forum references to updating the config files to switch on SimplePageHeaders deviceinfo setting, but I can find no reference to this in the documentation and it appears to be ignored when I try it out. Is this in RS 2005 only? (I'm using 2000 SP2).

Would this get round my current problem of having lots of additional columns/merged cells to accommodate all the header layout when exported to Excel? Ideally I want the data structure in Excel to be a straight forward matrix of the data values in the report table which isn't feasible when exported to Excel with our default headers which contains a lot of labels containing context information.

I am pretty sure this is new in 2005. and yes, it would help you get past your merged cell problem.

Excel headers - using SimplePageHeaders deviceinfo setting

I want to try out placing the report header in the Excel page header instead of the worksheet. I have seen forum references to updating the config files to switch on SimplePageHeaders deviceinfo setting, but I can find no reference to this in the documentation and it appears to be ignored when I try it out. Is this in RS 2005 only? (I'm using 2000 SP2).

Would this get round my current problem of having lots of additional columns/merged cells to accommodate all the header layout when exported to Excel? Ideally I want the data structure in Excel to be a straight forward matrix of the data values in the report table which isn't feasible when exported to Excel with our default headers which contains a lot of labels containing context information.

I am pretty sure this is new in 2005. and yes, it would help you get past your merged cell problem.