问题描述
Win7系统VS2008SQL2008第一次接手做网页报表原来的包可能是VS2005+SQL2005做的,现在在2008上编译过不去.引用的是一个App_CodeMicrosoft.SqlServer.ReportingServices.ReportService2005文件夹publiceventListSecureMethodsCompletedEventHandlerListSecureMethodsCompleted{[MethodImpl(MethodImplOptions.Synchronized)]add{this.ListSecureMethodsCompleted=(ListSecureMethodsCompletedEventHandler)Delegate.Combine(this.ListSecureMethodsCompleted,value);}[MethodImpl(MethodImplOptions.Synchronized)]remove{this.ListSecureMethodsCompleted=(ListSecureMethodsCompletedEventHandler)Delegate.Remove(this.ListSecureMethodsCompleted,value);}}错误定位在红色的上,有很多这各路错误1事件“Microsoft.SqlServer.ReportingServices.ReportExecutionService.ReportExecutionService.ListSecureMethodsCompleted”只能出现在+=或-=的左边App_CodeMicrosoft.SqlServer.ReportingServices.ReportExecutionServiceReportExecutionService.cs4310App_Code
解决方案
解决方案二:
Delegate是只能在定义的那个类中直接调用的,其它地方只能用+=或-=来添加或删除对应执行的方法改this.ListSecureMethodsCompleted+=(ListSecureMethodsCompletedEventHandler)Delegate.Combine(this.ListSecureMethodsCompleted,value);
解决方案三:
谢谢Delegate.Combine(this.ListSecureMethodsCompleted,value);这里也提示出错,要怎么改
解决方案四:
都是提示上面那个错
解决方案五:
privatevoidOnListSecureMethodsOperationCompleted(objectarg){if(this.ListSecureMethodsCompleted!=null){InvokeCompletedEventArgsinvokeCompletedEventArgs=(InvokeCompletedEventArgs)arg;this.ListSecureMethodsCompleted(this,newListSecureMethodsCompletedEventArgs(invokeCompletedEventArgs.Results,invokeCompletedEventArgs.Error,invokeCompletedEventArgs.Cancelled,invokeCompletedEventArgs.UserState));}}红色的都是提示都是这样子.错误1事件“Microsoft.SqlServer.ReportingServices.ReportExecutionService.ReportExecutionService.ListSecureMethodsCompleted”只能出现在+=或-=的左边App_CodeMicrosoft.SqlServer.ReportingServices.ReportExecutionServiceReportExecutionService.cs37713App_Code
解决方案六:
你是怎么解决的啊
解决方案七:
this.ListSecureMethodsCompleted,看名字应该需要给他的委托赋值。应该是this.ListSecureMethodsCompleted+=某个方法。
解决方案八:
privateListSecureMethodsCompletedEventHandlerlistSecureMethodsCompletedEventHandler;publiceventListSecureMethodsCompletedEventHandlerListSecureMethodsCompleted{[MethodImpl(MethodImplOptions.Synchronized)]add{this.listSecureMethodsCompletedEventHandler=(ListSecureMethodsCompletedEventHandler)Delegate.Combine(this.listSecureMethodsCompletedEventHandler,value);}[MethodImpl(MethodImplOptions.Synchronized)]remove{this.listSecureMethodsCompletedEventHandler=(ListSecureMethodsCompletedEventHandler)Delegate.Remove(this.listSecureMethodsCompletedEventHandler,value);}}}
或者也可以这样写privateListSecureMethodsCompletedEventHandlerlistSecureMethodsCompletedEventHandler;publiceventListSecureMethodsCompletedEventHandlerListSecureMethodsCompleted{[MethodImpl(MethodImplOptions.Synchronized)]add{this.listSecureMethodsCompletedEventHandler+=value;}[MethodImpl(MethodImplOptions.Synchronized)]remove{this.listSecureMethodsCompletedEventHandler-=value;}
解决方案九:
想简单一点的话就直接这样写:publiceventListSecureMethodsCompletedEventHandlerListSecureMethodsCompleted;
解决方案十:
add和remove里用value指代+=右边的delegate