Passing arrays from a server-function/sub to a server -variable 
Author Message
 Passing arrays from a server-function/sub to a server -variable

Hi,

I want to use a function to read the records of a recordset into an array.
This array is used to fill a HTML-table to display the records.

I created the function in an include-file and call it from within a
server-script on my asp-page (The inc-file is included in this asp-page)

I can't get it to work. Every time the error "Type Mismatch" occurs when I
try to fill my array in the server-script with the return-array of the
function.

Can somebody help me with this? I just started with using scripting and like
the things you can do with it but I am not that experienced.

Paul



Tue, 06 May 2003 03:00:00 GMT  
 Passing arrays from a server-function/sub to a server -variable
You might need to post a code snippet to get more specific help; when you say you
are trying to "fill your array... with the return array," what exactly are you
doing? If your function returns an array (presumably filled with the recordset
values you want) then there's no more "filling" to be done, if I'm reading your
question right.
Quote:
-----Original Message-----

Hi,

I want to use a function to read the records of a recordset into an array.
This array is used to fill a HTML-table to display the records.

I created the function in an include-file and call it from within a
server-script on my asp-page (The inc-file is included in this asp-page)

I can't get it to work. Every time the error "Type Mismatch" occurs when I
try to fill my array in the server-script with the return-array of the
function.

Can somebody help me with this? I just started with using scripting and like
the things you can do with it but I am not that experienced.

Paul

.



Tue, 06 May 2003 03:00:00 GMT  
 Passing arrays from a server-function/sub to a server -variable
Dim arWrong(1)
on error resume next
arWrong = getDataArray() 'throws type mismatch
msgbox "(1) error:" & err.description

Dim arAlsoWrong()
on error resume next
arAlsoWrong = getDataArray() 'throws type mismatch
msgbox "(2) error:" & err.description

on error goto 0
Dim arCorrect
arCorrect = getDataArray()
msgbox "(3) error:" & err.description
msgbox isArray(arCorrect)

function getDataArray()
  Dim arData(1)
  arData(0) = "a"
  arData(1) = "b"
  getDataArray = arData
end function

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> Hi,

> I want to use a function to read the records of a recordset into an array.
> This array is used to fill a HTML-table to display the records.

> I created the function in an include-file and call it from within a
> server-script on my asp-page (The inc-file is included in this asp-page)

> I can't get it to work. Every time the error "Type Mismatch" occurs when I
> try to fill my array in the server-script with the return-array of the
> function.

> Can somebody help me with this? I just started with using scripting and like
> the things you can do with it but I am not that experienced.

> Paul



Tue, 06 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing variable to server-side function???

2. ASP VBScript function like Server.Execute which can pass variables

3. Calling a sub or function using a variable through another sub or function

4. Passing an array to a sub or function I get type mismatch

5. Pass client script variable to server script variable

6. pass an array as function/sub argument

7. Question on passing array parameters to VB.NET Sub/Function

8. Passing array back from Sub/Function

9. Passing arrays to SUBs and FUNCTIONs

10. pass an array as function/sub argument

11. Pass control array to sub/function ?

12. Passing Arrays to Sub / Functions

 

 
Powered by phpBB® Forum Software