开发者

Calling a .NET Function that requires a .NET type from Classic ASP

Please Help me.I am trying to over come this paoblem from last 2 days But i am not able to overcome.

I was able to set up the environment so that I can call .NET method (via COM) from a classic ASP page.

Everything actually works as intended until when I have to call a .NET method that requires a .NET type.

So I have a method named SetTable Like Below

I have a function like this in .Net

Public Sub SetTable(ByVal _City As City, ByVal _Country As Country)
          'doing some thing
End Sub

and i have asp code like this:

dim CountryUtil, City, Country
set CountryUtil= Server.CreateObject("mydll.CountryUtil")
set City= Server.CreateObject("mydll.City")
set Country = Server.CreateObject("mydll.Coun开发者_Go百科try")
city.id= 123
city.property = "so and so"

Country.id= 123
Country.property = "so and so"

CountryUtil.SetTable(City, Country)

' I get this error here:

'Microsoft VBScript runtime error '800a0005' 'Invalid procedure call or argument: 'SetTable'

Thanks in advance.


in vbscript you only have variants so Country and City are just objects of type variant not of type Country or City.

you will have to change the .net method SetTable (or write a new one) which accepts "variants" (object) and then cast those objects to your .net City and Country objects.


My vbscript is a bit rusty, but don't you need to write this instead (without parens)?

CountryUtil.SetTable City, Country
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜