Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Help ON GetRows method of ADODB.Recordset in COM


Message #1 by jpipes@a... on Tue, 8 Aug 2000 23:21:48
I am having trouble using the GetRows method of the ADODB.Recordset object 

within a custom COM component created in VB6.  The object is stateless, and 

the method being called takes two parameters (a Work Order Number (String) 

and a UserCode (String) and returns a Variant.



Using this code, I am attempting to return the work information to my ASP 

page as an array:



Public Function GetWorkOrder(strWorkOrderNumber, strUserCode) As Variant

' Dims...

' Connection info...

...

Set rst = New ADODB.Recordset

Set rst = cmd.open ...

GetWorkOrder = rst.GetRows



' Error Handling

End Function



In my ASP page I have the following



Dim oWO

Dim array



Set oWO = Server.CreateObject("MyDLL.MyClass")

array = oWO.GetWorkOrder

Set oWO = Nothing



For i = 0 to UBound(array) - 1

    Response.Write "Field value: " & array(i) & "<BR>"

Next

Response.end



This keeps returing a variety of errors, from subscript out of range, which 

has to do with the array index being out of bounds.  I have already tried 

numerous index values (both L and UBounds) and nothing seems to work.  I 

seems that the variant returned from my COM object is not being properly 

cast into an array in my ASP script.



Counld somebody PLEASE help me out on this one...





You aid is greatly appreciated,



Jay



Message #2 by "Michael Angelo Libio" <malibio@h...> on Fri, 28 Jul 2000 10:37:49 -0700
The array that is returned by the GetRows() method of a recordset object is

always two dimensional: array(x, y) -- representing the table, view, query,

etc....  When you use UBound(array) it will only give you the upper bound

value of the x dimension (the highest index number representing the fields

not the rows).  So in other words, you need to loop through the fields AND

the rows.  Try using something like this:



Response.Write "<TABLE BORDER=""1"">"

For i = 0 To UBound(arrData, 2) 'through each row

    Response.Write "<TR>"

    For j = 0 To UBound(arrData, 1) 'through each field of the current row

        Response.Write "<TD>" & arrData(j, i) & "</TD>"

    Next

    Response.Write "</TR>"

Next

Response.Write "</TABLE>"





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

From: <jpipes

To: "ASP components" <asp_components@p...>

Sent: Tuesday, August 08, 2000 11:21 PM

Subject: [asp_components] Help ON GetRows method of ADODB.Recordset in COM





> I am having trouble using the GetRows method of the ADODB.Recordset object

> within a custom COM component created in VB6.  The object is stateless,

and

> the method being called takes two parameters (a Work Order Number (String)

> and a UserCode (String) and returns a Variant.

>

> Using this code, I am attempting to return the work information to my ASP

> page as an array:

>

> Public Function GetWorkOrder(strWorkOrderNumber, strUserCode) As Variant

> ' Dims...

> ' Connection info...

> ...

> Set rst = New ADODB.Recordset

> Set rst = cmd.open ...

> GetWorkOrder = rst.GetRows

>

> ' Error Handling

> End Function

>

> In my ASP page I have the following

>

> Dim oWO

> Dim array

>

> Set oWO = Server.CreateObject("MyDLL.MyClass")

> array = oWO.GetWorkOrder

> Set oWO = Nothing

>

> For i = 0 to UBound(array) - 1

>     Response.Write "Field value: " & array(i) & "<BR>"

> Next

> Response.end

>

> This keeps returing a variety of errors, from subscript out of range,

which

> has to do with the array index being out of bounds.  I have already tried

> numerous index values (both L and UBounds) and nothing seems to work.  I

> seems that the variant returned from my COM object is not being properly

> cast into an array in my ASP script.

>

> Counld somebody PLEASE help me out on this one...

>

>

> You aid is greatly appreciated,

>

> Jay

>

>

Message #3 by Chris Kinsella <chris.kinsella@n...> on Thu, 10 Aug 2000 10:37:16 +0100
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C002AE.92543F30

Content-Type: text/plain;

	charset="iso-8859-1"







Jay,



I've noticed that you do not pass any parameters in the call of your

oWO.GetWorkOrder member function



As I'm pretty new to this area myself, do you set properties of internal

member variables (ie for the parameters strWorkOrderNumber and strUserCode)

for the before calling the method?



cheers



chris











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

From: ASP components digest [mailto:asp_components@p...]

Sent: 10 August 2000 08:00

To: asp_components digest recipients

Subject: asp_components digest: August 09, 2000





ASP components Digest for Wednesday, August 09, 2000.



1. RE: GuidMaker problems

2. Help ON GetRows method of ADODB.Recordset in COM



----------------------------------------------------------------------



Subject: RE: GuidMaker problems

From: "Dana Coffey" <dcoffey@x...>

Date: Tue, 8 Aug 2000 13:12:51 -0400

X-Message-Number: 1



forgive me if this is a silly question, but did you reboot your machine

after removing and then again after reinstalling the dll?



Also, did you check the registry to make sure it was removed?





Dana Coffey

Technologist, Xceed, Inc.

112 Krog St.  Atlanta, GA  30307

tel.  xxx-xxx-xxxx  x 5013

dcoffey@x...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Everything should be as simple as it is, but not simpler.

----Albert Einstein

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~









{{-----Original Message-----

{{From: Daniel Walker [mailto:danielw@w...]

{{Sent: Tuesday, August 08, 2000 6:00 PM

{{To: ASP components

{{Subject: [asp_components] RE: GuidMaker problems

{{

{{

{{Good suggestion, but I don't think so. VBScript is case-insensitive.

{{

{{Daniel Walker

{{Wrox Press

{{

{{On 08/08/00, ""Scheer, Joseph (S/W Prod_Dev/RM)" wrote:

{{> If you have specified "Option Explicit" earlier in you script,

{{the problem

{{may be due to the difference is case between objGUID and objGuid, the

{{latter

{{being considered an undeclared variable.

{{

{{-----Original Message-----

{{From: David Tong

{{Sent: Monday, July 31, 2000 6:44 AM

{{To: ASP components

{{Subject: [asp_components] GuidMaker problems

{{

{{

{{hi can some one please help...

{{can you please give me on advice on how to sort out this problem.

{{

{{I have a problem with a dll.

{{I have un registered the GuidMakr.dll and re registered it.

{{the dll creates a Guid. I am using it to create a unique identify for when

{{adding a record to a database. the problem  is on this line.

{{

{{

{{177 Dim objGUID

{{178 Set objGuid = Server.CreateObject ("GuidMakr.GUID")

{{

{{the error message that comes back is.

{{

{{

{{Microsoft VBScript runtime error '800a01ad'

{{ActiveX component can't create object

{{/user/add/default.asp, line 178

{{

{{thanks David.

{{

{{---

{{

{{

{{$subst('Email.Unsub')

{{

{{---

{{

{{

{{$subst('Email.Unsub')

{{

{{





----------------------------------------------------------------------



Subject: Help ON GetRows method of ADODB.Recordset in COM

From: jpipes@a...

Date: Tue, 8 Aug 2000 23:21:48

X-Message-Number: 2



I am having trouble using the GetRows method of the ADODB.Recordset object 

within a custom COM component created in VB6.  The object is stateless, and 

the method being called takes two parameters (a Work Order Number (String) 

and a UserCode (String) and returns a Variant.



Using this code, I am attempting to return the work information to my ASP 

page as an array:



Public Function GetWorkOrder(strWorkOrderNumber, strUserCode) As Variant

' Dims...

' Connection info...

...

Set rst = New ADODB.Recordset

Set rst = cmd.open ...

GetWorkOrder = rst.GetRows



' Error Handling

End Function



In my ASP page I have the following



Dim oWO

Dim array



Set oWO = Server.CreateObject("MyDLL.MyClass")

array = oWO.GetWorkOrder

Set oWO = Nothing



For i = 0 to UBound(array) - 1

    Response.Write "Field value: " & array(i) & "<BR>"

Next

Response.end



This keeps returing a variety of errors, from subscript out of range, which 

has to do with the array index being out of bounds.  I have already tried 

numerous index values (both L and UBounds) and nothing seems to work.  I 

seems that the variant returned from my COM object is not being properly 

cast into an array in my ASP script.



Counld somebody PLEASE help me out on this one...





You aid is greatly appreciated,



Jay









---



END OF DIGEST






$subst('Email.Unsub')





  Return to Index