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