Solved

Passing an Array from ASP to VB DLL

Posted on 2000-03-20
2
391 Views
Last Modified: 2012-08-13
Hi

I have a VB DLL and in that I have a function called savedata(InputArr as variant) as integer

I am doing some manipulations of the array elements there and after that I have to insert the data in to the database.

I am populating that Array in an ASP page. I want to pass the entire array from ASP page to the VB DLL. The code in ASP page looks like this:

dim objhelper
set objHelper=server.CreateObject("HelperObject.Helper")

if isobject(objhelper) then

 if objhelper.SaveData(DLLARR) = -1 then
      
            Response.Write("fail")
      else
            Response.Write("Success")
      end if      
 end if

It is creating the object. But it is giving an error like

Invalid procedure call or argument error '800a0005'
Invalid procedure call or argument

/tradecom/members/newaccount/create_fldsArray.asp, line 88


It is giving error in yh eline "if objhelper.SaveData(DLLARR) = -1 then".

DLLARR is my array.


Hope somebody can give me some hints.

Thanks
RR
0
Comment
Question by:r_nair
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
tamirp earned 50 total points
ID: 2636454
ID: Q217114,Q174576,Q244012 all arrays to the VB must be Variant by type and passed by reference.
so you would declare the helperobject procedure as:
Public Function savedata(ByRef InputArr as variant) as integer.

yours,
Tamir
some examples:

URLS:
http://support.microsoft.com/support/kb/articles/Q217/1/14.ASP
http://support.microsoft.com/support/kb/articles/Q244/0/12.ASP
http://support.microsoft.com/support/kb/articles/Q174/5/76.ASP

0
 

Expert Comment

by:Tension
ID: 2677177

  Try out this r nair...

Sample Code
~~~~~~~~~~~

 Try out this r_nair ...

ASP Code
~~~~~~~~

dim objhelper
set objHelper=server.CreateObject("HelperObject.Helper")

Dim temparr(5)
temparr(0) = "x"
z = x.Arr(temparr)

VB Dll Code
~~~~~~~~~~~

Public Sub Arr(x As Variant)

Dim z()
z = x

MsgBox z(0)
MsgBox UBound(x)

End Sub
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question