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
No comments:
Post a Comment