asp调用dll二维数组函数时出现类型不匹配,急!

navysky 2010-07-17 02:13:30
用asp调用VB写的二维数组函数(dll)时,出现类型不匹配
Public Function getServerClassArray() As String()
ReDim cidsArrayList(3, 1) As String
cidsArrayList(0, 0) = "a"
cidsArrayList(0, 1) = "1"
cidsArrayList(1, 0) = "b"
cidsArrayList(1, 1) = "2"
cidsArrayList(2, 0) = "c"
cidsArrayList(2, 1) = "3"
cidsArrayList(3, 0) = "d"
cidsArrayList(3, 1) = "4"
getServerClassArray= cidsArrayList
End Function

asp 部分:
redim cidsArrayList(3,1)
cidsArrayList = fun.getServerClassArray()
此处提示:类型不匹配

应该如何调用VB写的二维数组呢?谢谢各位!
...全文
45 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wcwtitxu 2010-08-05

Public Function getServerClassArray() As Variant()
ReDim cidsArrayList(3, 1) As Variant
cidsArrayList(0, 0) = "a"
cidsArrayList(0, 1) = "1"
cidsArrayList(1, 0) = "b"
cidsArrayList(1, 1) = "2"
cidsArrayList(2, 0) = "c"
cidsArrayList(2, 1) = "3"
cidsArrayList(3, 0) = "d"
cidsArrayList(3, 1) = "4"
getServerClassArray = cidsArrayList
End Function




Dim cidsArrayList
cidsArrayList = fun.getServerClassArray()
回复
navysky 2010-07-17
谢谢楼上的朋友,哪位高手可以给个建议
回复
叫我梁大侠 2010-07-17
帮你顶下
回复
yudoggy 2010-07-17

Public Function getServerClassArray() As Variable

先这样试试。如果还不行,就把数组作为一个参数以byref方式传进去

Public Function getServerClassArray(byref cidsArrayList As Variable) As Integer
ReDim cidsArrayList(3, 1) As String
....
' getServerClassArray= cidsArrayList 这行去掉
End Function

' 页面上
Dim cidsArrayList
Call fun.getServerClassArray(cidsArrayList)

回复
mocom 2010-07-17
Dim cidsArrayList
cidsArrayList = fun.getServerClassArray()
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告