Groups | Blog | Home
all groups > sql server reporting services > may 2006 >

sql server reporting services : calling custom assembly just wont work...


taz
5/3/2006 2:29:01 AM
i am trying to call a custom assembly from a
report and it just wont work.

my code is as follows:

---

Public Class Module1
Public Shared Function Hello() As Integer

Return 2

End Function

End Class

---

i want to use this function to calculate one of my
dataset parameters. i have used this expression:
=FundTrackHelper.Module1.Hello()

this is the error i get:

Error 102 [rsCompilerErrorInExpression] The Value expression for the query
parameter ‘@organ_pkey’ contains an error: [BC30389]
'FundTrackHelper.Module1' is not accessible in this context because it is
'Private'.
c:\srcsafe\vs2005\reports\fundtrackreports\fundtrackreports\TEST.rdl 0 0

i have copied the assembly into: C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\PrivateAssemblies

i also did try to modify the rssrvpolicy.config file to grant the assembly
code
permissions beyond the default execute permissions but this had no effect
so i took the modification out. furthermore, i dont think a simple piece
of code like this needs any extra permissions anyway.

any ideas appreciated.

thanks.

Bava Mani
5/3/2006 8:27:01 AM
Hi,
did you had a reference of the assemblie in the report property..
can you define the method as static function and access it?




[quoted text, click to view]
taz
5/5/2006 9:17:03 AM
c
hi,

yes i did add to references but i am not sure what
to put in the report properties | class name and
instance name bits - any help appreciated.

here is my code (the project is called FundTrackHelper):

Namespace xyz

Public Class Module1

Public Shared Function Hello() As Integer
Return 2
End Function

End Class

End Namespace



[quoted text, click to view]
Thomo
5/5/2006 9:28:31 AM
I think the problem might be that as far as I know you can only call
static methods in classes. Try making it static and see if this works
taz
5/8/2006 2:08:02 AM


tried to make the method static and it tells me:

Methods cannot be declared 'Static'

doesnt the 'Shared' keyword do the same thing? if so, as
u can see i am already using that...

[quoted text, click to view]
Thomo
5/8/2006 8:04:14 AM
sorry Taz, I didn't notice this earlier, from what I understand the
Shared statment is the equivalent of static in C#

you said that you compiled the assembly into C:\Program Files\Microsoft
Visual Studio
8\Common7\IDE\PrivateAssemblies, the assemblies that I call from my
report however are simply placed under the GAC.

Can you check to see if your assembly is under the
c:\Windows\Assemblies\ folder

Also the error seems to be complaining about the access level of the
Class <i>'FundTrackHelper.Module1' is not accessible in this context
because it is 'Private'. </i>

Not sure why it would be doing this if the class and member are
declared as 'Public' as you say above, maybe write a small test app
that can reference the same class / method and make sure this works.
taz
5/8/2006 9:22:02 AM

this morning i basically deleted my custom assembly and
created a new one from scratch with a namespace and it
now works. thanks for your help. i am sure i'll have loads
of other questions as well !!!!!

[quoted text, click to view]
AddThis Social Bookmark Button