Solved

Passing an Array from ASP to VB DLL

Posted on 2000-03-20
2
386 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now