6
我需要为我的经典ASP创建一个COM对象,因为我可以创建一个.net程序集,并使用'COM'与COM互操作,所以我继续创建.NET程序集是这样的: -COM Interop(如何将数组传递给COM)通过传统的ASP
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Web;
namespace LMS
{
[ComVisible(true)]
public class Calc
{
public int Add(int val1, int val2, out string[] outputz)
{
int total = val1 + val2;
outputz = new string[5];
outputz[1] = "test2";
outputz[2] = "test3";
outputz[3] = "test4";
outputz[4] = "test5";
return total;
}
}
}
接下来我做了平时,建造,运行:GACUTIL & RegAsm
,并在我的传统的ASP页面,我有这样的: -
Dim params
dim objPassport3
set objPassport3 = Server.CreateObject("LMS.Calc")
comTest2 = objPassport3.Add(1,1,params)
和我得到的错误:
Error Type: Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument: 'Add' /eduservice/test.asp, line 25
但是,如果我修改大会不要使用数组,这一切只是工作,我甚至可以发送普通字符串或int和从组装到传统的ASP。 我看了这么多的东西,但我得到了同样的错误,
人之前尝试这样做,是成功的,请你分享你的解决方案
感谢
感谢这么多的答复......等不及try..will更新您的状态 – visual 2009-08-31 21:24:36
OrbMan,谢谢,你解决了我的问题,希望我能治疗你吃午饭。 – visual 2009-09-01 00:57:45
没有probs,很高兴提供帮助。 – RedFilter 2009-09-01 12:24:46