all groups > sql server reporting services > april 2005 >
You're in the

sql server reporting services

group:

OnInit Event for Instances of Classes in Custom Assemblies


OnInit Event for Instances of Classes in Custom Assemblies Adam
4/7/2005 2:29:03 PM
sql server reporting services:
I am trying Preview, DebugLocal, and Delploy a report that is overriding the
OnInit method of the Code object as described in MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_rdl_7gma.asp

I recieve error [BC30469] Reference to a non-shared member requires an
object reference.

Any thoughts?

Thanks in advance,

Adam

-- RDL --
<Classes>
<Class>
<ClassName>ScoreCardRsLib.SitReport</ClassName>
<InstanceName>mSitReport</InstanceName>
</Class>
</Classes>
<CodeModules>
<CodeModule>ScoreCardRsLib, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null</CodeModule>
</CodeModules>

<Code>

' Public sitReport As ScoreCardRsLib.SitReport
'
Protected Overrides Sub OnInit()
' Dim zsitReport As ScoreCardRsLib.SitReport
' sitReport = new ScoreCardRsLib.SitReport()
sitReport.Initialize(Globals, User, Parameters)
End Sub
</Code>

-- C# Code --
using System;
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;
namespace ScoreCardRsLib
{
Public Class SitReport
{
Globals g;
User u;
Parameters p;

public SitReport()
{
}

public void Initialize(Globals g, User u, Parameters p)
{
this.g = g;
this.u = u;
this.p = p;
}

public Globals Globals { get { return this.g; } }
public User User { get { return this.u; } }
public Parameters { get { return this.p; } }
}
RE: OnInit Event for Instances of Classes in Custom Assemblies Aaron
5/18/2005 1:42:02 PM
Might want to look here:

http://msdn.microsoft.com/newsgroups/default.aspx?query=oninit&dg=microsoft.public.sqlserver.reportingsvcs&cat=en-us-msdn-enterprise-sqlserver&lang=en&cr=US&pt=261ba873-f3ab-420e-96d6-e3004596a551&catlist=774F24A2-F71F-425F-AC2B-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us

[quoted text, click to view]
Re: OnInit Event for Instances of Classes in Custom Assemblies Alexandre Mineev
5/18/2005 3:01:17 PM
This looks like a bug in docs.
The only way to get Globals, User and Parameters inside of OnInit (and any
other function defined in <Code>) is thru the Report property:

Protected Overrides Sub OnInit()
' Dim zsitReport As ScoreCardRsLib.SitReport
' sitReport = new ScoreCardRsLib.SitReport()
sitReport.Initialize(Report.Globals, Report.User, Report.Parameters)
End Sub


--
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button