Problem on calling C# component method from asp page

C

Cindy Liu

Hi Everyone,

I created C# COM+ component. It has two overloaded methods - the method names are same and their signatures are different, one takes two parameters and another takes four. I coded this way: the method with 4 parameters is coded first and then the one with 2 parameters.

I created very simple ASP page to call these two methods. Calling the method with 4 params has no problem. However, calling the method with 2 params I get the error saying:

Error Type:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'SetReferenceValues'
/suitevoyager/testLmx.asp, line 16

How can I solve this problem?

Thanks in advance!!!
Cindy
 
R

Ray at

Cindy Liu said:
Hi Everyone,

I created C# COM+ component. It has two overloaded methods - the method
names are same

Why?!
and their signatures are different, one takes two parameters and another
takes four. I coded this way: the method with 4 parameters is coded first
and then the one with 2 parameters.
I created very simple ASP page to call these two methods. Calling the
method with 4 params has no problem. However, calling the method with 2
params I get the error saying:
Error Type:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'SetReferenceValues'
/suitevoyager/testLmx.asp, line 16

What is the line of code on line 16? Have you created an instance of the
object at this point?

Ray at work
 
C

Cindy Liu

Yes, I did create an instance of my COM+ object. Line 16 is the line that I call the method with 2 params.

Why I need 2 methods with same name and different signature? Because these methods perform the same functionality, one need to pass in user name and password, the another uses the credential specified in the configuration file.

Do I answer your questions?
Cindy
 
M

Mark Schupp

VBScript does not support optional parameters. I think that would preclude
the possibility of any support for overloaded functions as well.

You might give jscript a try. If that doesn't work you will have to just use
the 4-parameter version each time or modify the object so that the functions
are no longer overloaded.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


Cindy Liu said:
Yes, I did create an instance of my COM+ object. Line 16 is the line that
I call the method with 2 params.
Why I need 2 methods with same name and different signature? Because these
methods perform the same functionality, one need to pass in user name and
password, the another uses the credential specified in the configuration
file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,408
Latest member
AlenaRay88

Latest Threads

Top