Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ADO connection


Message #1 by "Phil Perks" <philp@w...> on Thu, 10 Aug 2000 21:13:30
-----Original Message-----

From: Gordon Veltenaar [mailto:g.veltenaar@h...]

Sent: 10 August 2000 17:44

To: support@w...

Subject: ADO connection





I've purchased the VB6 MTS book by Wrox.



I need some help... I have a COM+ object that connects and retrieves DB 

info from a SQl Server 7 DB after being called from an ASP page. A 

disconnected recordset is returned to the ASP page by the object. Here is 

the problem.

 

It was suggested that I close the DB connection in the COM object before 

exiting the function. I do this. When I return to the ASP page and access

and try to access the recordset, I get an error stating that the recordset 

cannot be found (you know what I mean, the connection is broken). I don't 

get it! The object returns a DISCONNECTED RECORDSET that was assigned 

BEFORE the connection was closed. Why doesn't the client (the ASP page)

have access to this recordset after the DB connection has been closed???

 



Axiom Internet Services

Phone  xxx-xxx-xxxx

Cell  xxx-xxx-xxxx

Message #2 by Fredrik Normen <fredrik.normen@s...> on Fri, 11 Aug 2000 10:49:29 +0200

Check if you try to close the Recordset.

You cant close the recordset object if you are using Disconnected recordset.



After you have open the recordset you use set ActiveConnection = Nothing



Here is an example how to create a disconnected recordset.





Public function GetRS() As Recordset



    Dim rs As ADODB.Recordset

    Dim cmd As ADODB.Command

    

    Set rs = New ADODB.Recordset

    Set cmd = New ADODB.Command



    cmd.CommandText = "SELECT * FROM Table"

    cmd.CommandType = adCmdText

    cmd.ActiveConnection = strConn

    

    rs.CursorLocation = adUseClient

    rs.Open cmd, , adOpenStatic, adLockReadOnly

    

    Set cmd.ActiveConnection = Nothing

    Set cmd = Nothing

    Set rs.ActiveConnection = Nothing

    

    Set RunSQLReturnRS = rs



End function



I hope this example will help you.



/Fredrik Normen



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



I've purchased the VB6 MTS book by Wrox.



I need some help... I have a COM+ object that connects and retrieves DB 

info from a SQl Server 7 DB after being called from an ASP page. A 

disconnected recordset is returned to the ASP page by the object. Here is 

the problem.

 

It was suggested that I close the DB connection in the COM object before 

exiting the function. I do this. When I return to the ASP page and access

and try to access the recordset, I get an error stating that the recordset 

cannot be found (you know what I mean, the connection is broken). I don't 

get it! The object returns a DISCONNECTED RECORDSET that was assigned 

BEFORE the connection was closed. Why doesn't the client (the ASP page)

have access to this recordset after the DB connection has been closed???

 



Axiom Internet Services

Phone  xxx-xxx-xxxx

Cell  xxx-xxx-xxxx



---

You are currently subscribed to asp_databases 


Message #3 by Chao Zhou <ChaoZhou@e...> on Tue, 15 Aug 2000 10:12:06 -0400
    ' Use client-side cursor	

    oRst.CursorLocation = adUseClient

    	

    

    ' Disconnect the recordset

    Set oRst.ActiveConnection = Nothing

    Set getRecordSet = oRst	 

	

I used to use the above code in VB COM and it works in ASP code.





Thanks,





Chao Zhou







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

From: Phil Perks [mailto:philp@w...]

Sent: Thursday, August 10, 2000 4:14 PM

To: ASP Databases

Subject: [asp_databases] ADO connection





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

From: Gordon Veltenaar [mailto:g.veltenaar@h...]

Sent: 10 August 2000 17:44

To: support@w...

Subject: ADO connection





I've purchased the VB6 MTS book by Wrox.



I need some help... I have a COM+ object that connects and retrieves DB 

info from a SQl Server 7 DB after being called from an ASP page. A 

disconnected recordset is returned to the ASP page by the object. Here is 

the problem.

 

It was suggested that I close the DB connection in the COM object before 

exiting the function. I do this. When I return to the ASP page and access

and try to access the recordset, I get an error stating that the recordset 

cannot be found (you know what I mean, the connection is broken). I don't 

get it! The object returns a DISCONNECTED RECORDSET that was assigned 

BEFORE the connection was closed. Why doesn't the client (the ASP page)

have access to this recordset after the DB connection has been closed???

 



Axiom Internet Services

Phone  xxx-xxx-xxxx

Cell  xxx-xxx-xxxx



---

You are currently subscribed to asp_databases 



  Return to Index