473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Type mismatch error when accessing an array

Hello,
I have a method on a com+ object that is returning an array of objects.

I know the array is popluated as calls to check the ubound and lbound
show valid values. However, any calls to get the value of a cell in the

array results in a type mismatch error.
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/idmTest/userTest.asp, line 30
I have pasted below some of the samples that i have tried. Each results

in the error above. Any suggestions on how I can access this object
would be helpful.
' Call to get the array and to validate that it is an array.
Set userObj = Server.CreateObject("idmVBApi.ComUser")
userGrpAry = userObj.getUserGroups(5790)
arySize = ubound(userGrpAry)
response.write "userGrpAry size = " & lbound(userGrpAry) & " - " &
arySize & "<br>"
response.write "userGrpAry type isArray = " & isArray(userGrpAry) &
"<br>"
' the following fails
dim index
for index = lbound(userGrpAry) to ubound(userGrpAry)
response.Write "type = " & isobject(userGrpAry(index))
response.write userGrpAry(index).grpName
next
Calls to isNull(userGrpAry(index)) also fail.
Regards
Leslie

Oct 12 '05 #1
4 10601
le**********@yahoo.com wrote:
Hello,
I have a method on a com+ object that is returning an array of
objects.


It's hard to say without having first-hand access to your code. Hopefully
what's written in these articles will help:

http://support.microsoft.com/default...b;EN-US;244012
http://support.microsoft.com/default...b;EN-US;197956

Building COM Components That Take Full Advantage of Visual Basic and
Scripting
http://msdn.microsoft.com/library/te...bscriptcom.htm

Q218454 - HOWTO: Implement Array Arguments in Visual C++ COM Objects for
Active Server Pages
http://support.microsoft.com/default.aspx?kbid=218454

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Oct 12 '05 #2
Bob,

Thanks for your help. I have pasted the code below withe some comments
to explain what I am doing. What is interesting is that I can access
the object just fine in VB.net. Its just through asp that i am
struggling.

' Com+ object code
<ComClass(ComUser.ClassId, ComUser.InterfaceId, ComUser.EventsId)> _
Public Class ComUser

#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String =
"DDCA1246-62B9-40C2-B9DD-926808410D9C"
Public Const InterfaceId As String =
"0175C8FD-E0F1-4FEE-A0B4-48EE6C39DDF8"
Public Const EventsId As String =
"A7C3EE87-2BDB-4697-8781-F3CB6F68A46D"
#End Region

' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub

Public ComUser()

Public Function getUserGroups(ByVal userId As String) As
WSGroupValue()
Dim user As UserService
user = New UserService
Return user.getUserGroups(userId)
End Function

End Class

' asp code to call this object and related method
' this part works
Dim userObj
Dim grpVal
dim arySize

Set userObj = Server.CreateObject("idmVBApi.ComUser")
userGrpAry = userObj.getUserGroups(5790)
arySize = ubound(userGrpAry)

response.write "userGrpAry size = " & lbound(userGrpAry) & " - " &
arySize
response.write "userGrpAry type isArray = " & isArray(userGrpAry)

dim index
for index = lbound(userGrpAry) to ubound(userGrpAry)
' ***** each of these calls fails *****
response.Write "type = " & isobject(userGrpAry(index))
grpval = userGrpAry(index)
response.Write "Grp name = " & grpVal.grpName & "<br>"
next

Oct 12 '05 #3
le**********@yahoo.com wrote:
Bob,

Thanks for your help. I have pasted the code below withe some comments
to explain what I am doing. What is interesting is that I can access
the object just fine in VB.net. Its just through asp that i am
struggling.


That makes the articles i provided extremely relevant. Don't forget that
vbscript is a loosely-typed language, which makes communicating with a
strongly-typed language like VB.Net very tricky. Please carefully read those
articles. I'm sure at least one of them will contain the key to your
problem.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 12 '05 #4
Thanks Bob.

The answer was that in needed to return an array of objects and not an
array of a type.
ie. object() vs. WSGroupValue()

Oct 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Laura | last post by:
Help. Below is my code. Getting Type mismatch error on the noted line. I'm trying to send an array (aryNewD) with 4 columns and x rows to a function to save all the array info into a SQL Server...
7
by: Alan Silver | last post by:
Hello, I have been having problems with some blindingly simple ASP that fails. I have the following code ... Dim sAds, sAdverts() sAds = "1" & vbTab & "Ferret" & vbTab & "Furry" & vbCrLf...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
0
by: Ayoa | last post by:
I am attempting to call a web service from Access 2003 (using the built-in web services reference tool). The web service should return an array of integers. Example web method (C#) public...
3
by: Snow | last post by:
Hello: I have Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: '' The error happened at this line: if session("systemIdCount" & arrSystems(iLoop)) 0 The code like this:
25
by: SRR | last post by:
Consider the following code: #include <stdio.h> #include <string.h> struct test{ char a; } funTest( void ); int main( void ) {
4
by: yandhi | last post by:
Greetings, This is my first post here but I've been reading here a while and have developed a bit of a problem I thought I'd seek some advice on. As the subject suggests, I'm building a page with...
10
by: lasmith329 | last post by:
I've never posted a question on any site before, but after racking my head over this hurdle for days, I've caved. I'm working on a program that creates a kml file and exports it to Google Earth. In...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.