Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Return set of data to asp page


Message #1 by "Arbon Reimer" <arbon_reimer@h...> on Wed, 11 Jul 2001 14:10:13 -0600
A question for the gurus:



In a component I'm using, I wish to perform business logic on a recordset

and then return it to an .asp page.  The question I have is whether or not I

should do the following, based on performance and/or ease of programming:



1) Should I return the data to the .asp page as a variant array from

.GetRows or should I return an ADO Recordset?



2) I am currently getting one array full of a recordset, copying it, and

then doing the manipulation on the copied array.  Example:

arrFetchData=objRS.GetRows(-1)

For X = 0 to UBound(arrFetchData,2)

arrReturnData(0,X) = arrFetchData(0,X)

'now do some math or other business logic:

lngSomeLongNumber = arrFetchData(1,X) + 75.342

arrReturnData(1,X) = lngSomeLongNumber

Next



You get the idea... is there a more efficient way to do this?  Institute

another component?  Just do as I'm doing?  Thank you all in advance.



Regards,

Arbon Reimer

Message #2 by =?iso-8859-1?Q?Ezequiel_Esp=EDndola?= <eespindola@b...> on Thu, 12 Jul 2001 02:09:01 -0700
I think from my personal experience that handling the Recordset object

directly will give you a lot more flexibility than using an Array. Also, i

think arrays in VB are not a lot performant, but that will always depend on

what your logic will be. I'd suggest to return a disconnected recordset and

use it directly.



-----Original Message-----

From: Arbon Reimer [mailto:arbon_reimer@h...]

Sent: Miércoles, 11 de Julio de 2001 13:10

To: ASP components

Subject: [asp_components] Return set of data to asp page





A question for the gurus:



In a component I'm using, I wish to perform business logic on a recordset

and then return it to an .asp page.  The question I have is whether or not I

should do the following, based on performance and/or ease of programming:



1) Should I return the data to the .asp page as a variant array from

.GetRows or should I return an ADO Recordset?



2) I am currently getting one array full of a recordset, copying it, and

then doing the manipulation on the copied array.  Example:

arrFetchData=objRS.GetRows(-1)

For X = 0 to UBound(arrFetchData,2)

arrReturnData(0,X) = arrFetchData(0,X)

'now do some math or other business logic:

lngSomeLongNumber = arrFetchData(1,X) + 75.342

arrReturnData(1,X) = lngSomeLongNumber

Next



You get the idea... is there a more efficient way to do this?  Institute

another component?  Just do as I'm doing?  Thank you all in advance.



Regards,

Arbon Reimer



Message #3 by Hal Levy <hal.levy@s...> on Thu, 12 Jul 2001 08:09:48 -0400

1. Use .getrows as this lets you close your connection to the database 

that

much faster- making things perform better



2. Why copy to a new array? Your not doing anything wrong, per se, but 

your

using unnecessary cycles. In this case it would have small impact. If 

you

have many routines coded like this, you would see an impact when volume

increases. You would need to add additional hardware pre-maturely.

Especially of the array is of sufficient size to occupy a large 

quantity of

memory. Do this:



For X =3D 0 to UBound(arrFetchData,2)

	'now do some math or other business logic:

	arrFetchData(1,X) =3D arrFetchData(1,X) + 75.342

Next





Hal Levy

StarMedia Network, Inc.

Intranet Development Manager



> -----Original Message-----

> From: Arbon Reimer [mailto:arbon_reimer@h...]

> Sent: Wednesday, July 11, 2001 4:10 PM

> To: ASP components

> Subject: [asp_components] Return set of data to asp page

>

>

> A question for the gurus:

>

> In a component I'm using, I wish to perform business logic on

> a recordset

> and then return it to an .asp page.  The question I have is

> whether or not I

> should do the following, based on performance and/or ease of

> programming:

>

> 1) Should I return the data to the .asp page as a variant array from

> .GetRows or should I return an ADO Recordset?

>

> 2) I am currently getting one array full of a recordset,

> copying it, and

> then doing the manipulation on the copied array.  Example:

> arrFetchData=3DobjRS.GetRows(-1)

> For X =3D 0 to UBound(arrFetchData,2)

> arrReturnData(0,X) =3D arrFetchData(0,X)

> 'now do some math or other business logic:

> lngSomeLongNumber =3D arrFetchData(1,X) + 75.342

> arrReturnData(1,X) =3D lngSomeLongNumber

> Next

>

> You get the idea... is there a more efficient way to do this?

>  Institute

> another component?  Just do as I'm doing?  Thank you all in advance.

>

> Regards,

> Arbon Reimer

>

>


  Return to Index