Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Invalid Procedure Call or Arguement

Reply
Thread Tools

Invalid Procedure Call or Arguement

 
 
Matt
Guest
Posts: n/a
 
      05-05-2006
I am receiving the following error from the simple script below. This works
fine from a .NET form but when I access the dll from a Classic ASP page it
fails.

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'GetGroups'


Dim oUser 'As mnaSecurityUser
Dim oDBAdapter 'As mnasecurityDBAdapter
Dim group 'As mnasecurityGroup

Set oUser = Server.CreateObject("mnaSecurityControl.mnasecurit yUser")
Set oDBAdapter =
Server.CreateObject("mnaSecurityControl.mnasecurit yDBAdapter")

Set oUser = oDBAdapter.GetUser("mamarsha")
'This works ok
Response.Write "'" & oUser.FirstName & "'"

'This line returns the error
Set oUser.Groups = oDBAdapter.GetGroups(oUser)

For each group in oUser.Groups
Response.Write "'" & group.name & "'"
Next

GetGroups is a method that accepts an mnasecurityUser object as a parameter.
Groups (in oUser.Groups) is a collection object property of the
mnasecurityUser object.


 
Reply With Quote
 
 
 
 
Matt
Guest
Posts: n/a
 
      05-05-2006
I have found the culprit but I am not sure why it worked in .NET ok but not
from an ASP page? The GetUsers function accepted a parameter of the type
mnasecurityUser object.



Public Function GetUsers(ByRef oUser as mnasecurityUser) as
mnasecurityGroups



From my code I passed in oUser which was instantiated as a mnasecurityUser
object (see previous post for code)



I changed the function in my object to accept a UserID as an integer and
everything worked fine.



Public Function GetUsers(ByRef iUser As Integer) as mnasecurityGroups



From my Asp page I updated the following line of code



Set oUser.Groups = oDBAdpater.GetUsers(oUser)



to



Set oUser.Groups = oDBAdpater.GetUsers(oUser.ID)



Does anyone know why I can't pass an object as a parameter from an ASP page?
Or let me know what I did wrong in my ASP page when I was trying to pass the
object?



Thanks.



"Matt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am receiving the following error from the simple script below. This works
>fine from a .NET form but when I access the dll from a Classic ASP page it
>fails.
>
> Microsoft VBScript runtime error '800a0005'
>
> Invalid procedure call or argument: 'GetGroups'
>
>
> Dim oUser 'As mnaSecurityUser
> Dim oDBAdapter 'As mnasecurityDBAdapter
> Dim group 'As mnasecurityGroup
>
> Set oUser = Server.CreateObject("mnaSecurityControl.mnasecurit yUser")
> Set oDBAdapter =
> Server.CreateObject("mnaSecurityControl.mnasecurit yDBAdapter")
>
> Set oUser = oDBAdapter.GetUser("mamarsha")
> 'This works ok
> Response.Write "'" & oUser.FirstName & "'"
>
> 'This line returns the error
> Set oUser.Groups = oDBAdapter.GetGroups(oUser)
>
> For each group in oUser.Groups
> Response.Write "'" & group.name & "'"
> Next
>
> GetGroups is a method that accepts an mnasecurityUser object as a
> parameter. Groups (in oUser.Groups) is a collection object property of the
> mnasecurityUser object.
>



 
Reply With Quote
 
 
 
 
Bob Lehmann
Guest
Posts: n/a
 
      05-05-2006
> Does anyone know why I can't pass an object as a parameter

By 'parameter', I assume you mean argument.

You can pass objects to Subs and Functions in VBScript. What you can't do,
is declare the type for the Function / Sub argument.

No -
Public Function GetUsers(ByRef oUser as mnasecurityUser)

Yes -
Public Function GetUsers(ByRef oUser)

Bob Lehmann

"Matt" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I have found the culprit but I am not sure why it worked in .NET ok but

not
> from an ASP page? The GetUsers function accepted a parameter of the type
> mnasecurityUser object.
>
>
>
> Public Function GetUsers(ByRef oUser as mnasecurityUser) as
> mnasecurityGroups
>
>
>
> From my code I passed in oUser which was instantiated as a mnasecurityUser
> object (see previous post for code)
>
>
>
> I changed the function in my object to accept a UserID as an integer and
> everything worked fine.
>
>
>
> Public Function GetUsers(ByRef iUser As Integer) as mnasecurityGroups
>
>
>
> From my Asp page I updated the following line of code
>
>
>
> Set oUser.Groups = oDBAdpater.GetUsers(oUser)
>
>
>
> to
>
>
>
> Set oUser.Groups = oDBAdpater.GetUsers(oUser.ID)
>
>
>
> Does anyone know why I can't pass an object as a parameter from an ASP

page?
> Or let me know what I did wrong in my ASP page when I was trying to pass

the
> object?
>
>
>
> Thanks.
>
>
>
> "Matt" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am receiving the following error from the simple script below. This

works
> >fine from a .NET form but when I access the dll from a Classic ASP page

it
> >fails.
> >
> > Microsoft VBScript runtime error '800a0005'
> >
> > Invalid procedure call or argument: 'GetGroups'
> >
> >
> > Dim oUser 'As mnaSecurityUser
> > Dim oDBAdapter 'As mnasecurityDBAdapter
> > Dim group 'As mnasecurityGroup
> >
> > Set oUser = Server.CreateObject("mnaSecurityControl.mnasecurit yUser")
> > Set oDBAdapter =
> > Server.CreateObject("mnaSecurityControl.mnasecurit yDBAdapter")
> >
> > Set oUser = oDBAdapter.GetUser("mamarsha")
> > 'This works ok
> > Response.Write "'" & oUser.FirstName & "'"
> >
> > 'This line returns the error
> > Set oUser.Groups = oDBAdapter.GetGroups(oUser)
> >
> > For each group in oUser.Groups
> > Response.Write "'" & group.name & "'"
> > Next
> >
> > GetGroups is a method that accepts an mnasecurityUser object as a
> > parameter. Groups (in oUser.Groups) is a collection object property of

the
> > mnasecurityUser object.
> >

>
>



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      05-05-2006
Oops! I didn't read your initial post.

Still pretty much the same answer.

Everything in VBScript is a variant, so, if I remember correctly, the args
in the dll's Subs / Functions need to be of type Variant.


Bob Lehmann


"Matt" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I have found the culprit but I am not sure why it worked in .NET ok but

not
> from an ASP page? The GetUsers function accepted a parameter of the type
> mnasecurityUser object.
>
>
>
> Public Function GetUsers(ByRef oUser as mnasecurityUser) as
> mnasecurityGroups
>
>
>
> From my code I passed in oUser which was instantiated as a mnasecurityUser
> object (see previous post for code)
>
>
>
> I changed the function in my object to accept a UserID as an integer and
> everything worked fine.
>
>
>
> Public Function GetUsers(ByRef iUser As Integer) as mnasecurityGroups
>
>
>
> From my Asp page I updated the following line of code
>
>
>
> Set oUser.Groups = oDBAdpater.GetUsers(oUser)
>
>
>
> to
>
>
>
> Set oUser.Groups = oDBAdpater.GetUsers(oUser.ID)
>
>
>
> Does anyone know why I can't pass an object as a parameter from an ASP

page?
> Or let me know what I did wrong in my ASP page when I was trying to pass

the
> object?
>
>
>
> Thanks.
>
>
>
> "Matt" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am receiving the following error from the simple script below. This

works
> >fine from a .NET form but when I access the dll from a Classic ASP page

it
> >fails.
> >
> > Microsoft VBScript runtime error '800a0005'
> >
> > Invalid procedure call or argument: 'GetGroups'
> >
> >
> > Dim oUser 'As mnaSecurityUser
> > Dim oDBAdapter 'As mnasecurityDBAdapter
> > Dim group 'As mnasecurityGroup
> >
> > Set oUser = Server.CreateObject("mnaSecurityControl.mnasecurit yUser")
> > Set oDBAdapter =
> > Server.CreateObject("mnaSecurityControl.mnasecurit yDBAdapter")
> >
> > Set oUser = oDBAdapter.GetUser("mamarsha")
> > 'This works ok
> > Response.Write "'" & oUser.FirstName & "'"
> >
> > 'This line returns the error
> > Set oUser.Groups = oDBAdapter.GetGroups(oUser)
> >
> > For each group in oUser.Groups
> > Response.Write "'" & group.name & "'"
> > Next
> >
> > GetGroups is a method that accepts an mnasecurityUser object as a
> > parameter. Groups (in oUser.Groups) is a collection object property of

the
> > mnasecurityUser object.
> >

>
>



 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      05-05-2006

Thanks Bob.

If I set the argument to VariantType in my function, how can I then access
the object properties in the function?


"Bob Lehmann" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Oops! I didn't read your initial post.
>
> Still pretty much the same answer.
>
> Everything in VBScript is a variant, so, if I remember correctly, the args
> in the dll's Subs / Functions need to be of type Variant.
>
>
> Bob Lehmann
>
>
> "Matt" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I have found the culprit but I am not sure why it worked in .NET ok but

> not
>> from an ASP page? The GetUsers function accepted a parameter of the type
>> mnasecurityUser object.
>>
>>
>>
>> Public Function GetUsers(ByRef oUser as mnasecurityUser) as
>> mnasecurityGroups
>>
>>
>>
>> From my code I passed in oUser which was instantiated as a
>> mnasecurityUser
>> object (see previous post for code)
>>
>>
>>
>> I changed the function in my object to accept a UserID as an integer and
>> everything worked fine.
>>
>>
>>
>> Public Function GetUsers(ByRef iUser As Integer) as mnasecurityGroups
>>
>>
>>
>> From my Asp page I updated the following line of code
>>
>>
>>
>> Set oUser.Groups = oDBAdpater.GetUsers(oUser)
>>
>>
>>
>> to
>>
>>
>>
>> Set oUser.Groups = oDBAdpater.GetUsers(oUser.ID)
>>
>>
>>
>> Does anyone know why I can't pass an object as a parameter from an ASP

> page?
>> Or let me know what I did wrong in my ASP page when I was trying to pass

> the
>> object?
>>
>>
>>
>> Thanks.
>>
>>
>>
>> "Matt" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >I am receiving the following error from the simple script below. This

> works
>> >fine from a .NET form but when I access the dll from a Classic ASP page

> it
>> >fails.
>> >
>> > Microsoft VBScript runtime error '800a0005'
>> >
>> > Invalid procedure call or argument: 'GetGroups'
>> >
>> >
>> > Dim oUser 'As mnaSecurityUser
>> > Dim oDBAdapter 'As mnasecurityDBAdapter
>> > Dim group 'As mnasecurityGroup
>> >
>> > Set oUser = Server.CreateObject("mnaSecurityControl.mnasecurit yUser")
>> > Set oDBAdapter =
>> > Server.CreateObject("mnaSecurityControl.mnasecurit yDBAdapter")
>> >
>> > Set oUser = oDBAdapter.GetUser("mamarsha")
>> > 'This works ok
>> > Response.Write "'" & oUser.FirstName & "'"
>> >
>> > 'This line returns the error
>> > Set oUser.Groups = oDBAdapter.GetGroups(oUser)
>> >
>> > For each group in oUser.Groups
>> > Response.Write "'" & group.name & "'"
>> > Next
>> >
>> > GetGroups is a method that accepts an mnasecurityUser object as a
>> > parameter. Groups (in oUser.Groups) is a collection object property of

> the
>> > mnasecurityUser object.
>> >

>>
>>

>
>



 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      05-05-2006

"Matt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Thanks Bob.
>
> If I set the argument to VariantType in my function, how can I then access
> the object properties in the function?
>
>


Your real problem is the use of a ByRef. The only argument that VBScript
can pass byref is a variant.

Change the parameter to ByVal oUser as mnasecurityUser. You really should
use ByVal for most parameters anyway regardless of whether they are to be
called from script or not.

Anthony.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble with FileUtils.rm() -- Invalid arguement error an an Ruby 11 02-09-2008 02:52 AM
Error:Template as friend class with different arguement list Nike C++ 7 05-22-2007 07:29 AM
Invalid procedure call or argument: 'InStr' john@munsey.net ASP General 1 08-11-2005 11:59 AM
problem with \r\n and \n (when passing multi line string arguement) In-Ho Yi ASP .Net Web Services 1 12-11-2003 07:16 PM
eval's local arguement ignored? =?ISO-8859-1?Q?Jean-S=E9bastien_Bolduc?= Python 4 09-30-2003 10:05 PM



Advertisments