Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADO Record Sets in VBSCRIPT

Posted on 1998-08-04
5
Medium Priority
?
271 Views
Last Modified: 2013-11-23
How can I copy contents of a recordset into a new recordset, and be able to access the new one after closing the connections (both ado.connection and ado.recordset close)
0
Comment
Question by:Skyscrape
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Accepted Solution

by:
dzimme01 earned 100 total points
ID: 1467814
Set RsOld = Server.CreateObject("ADODB.Recordset")
'Write connect code
RsOld.Open
Set RsNew = RSOld.Clone
' You can now disconnect the old one without killing the new one.

You can also disconnect the recordset by closing the ActiveConnection and manipulate the recordset. If you need to update, just reconnect the ActiveConnection and UpdateBatch.

You could also use a variant array rather than a recordset.

dim varRows

varRows = rsOld.GetRows(adBookmarkFirst)
0
 

Author Comment

by:Skyscrape
ID: 1467815
This is the same solution offered in the MSDN library and the ADO reference.  However, I think this solution only works with SQL server, or more to the point it does not seem to work with an Oracle Server.  One solution is to create a recordset using RDS like so:
      Dim ds  
      Dim df  
      dim rs  
      Set df=Server.CreateObject("RDSServer.DataFactory")
      Set rs = df.Query("DSN=MYDSN;UID=MYUID;PWD=MYPWD;", _
                     "SELECT * FROM ExpenseCodes")
      Set rs.ActiveConnection = nothing  
           
But I dont like that solution.

0
 

Expert Comment

by:dzimme01
ID: 1467816
I don't have access to an Oracle server, so I'll have to take your word that this doesn't work. But since OLE DB providers should support a certain amount of functionality, I was wondering what exactly doesn't work. What is the error returned from the object? I'm also assuming that what your trying to accomplish, is to get a recordset and manipulate it while limiting the number of open connections to your database. Is this correct? Also what version AD0 are you using, and what version of IIS?
0
 

Author Comment

by:Skyscrape
ID: 1467817
That is correct.. To basically have a recordset without a connection. ADO1.5 i think, with IIS 4.0
0
 

Expert Comment

by:dzimme01
ID: 1467818
Using the Recordset.Supports property is the easiest way to verify that what you expect is actually what the provider exposed to you, given the specific type of connection and recordset you have opened. I would suggest checking if Oracle's OLE DB driver supports disconnected recordsets and batch updates. If it does, rather than cloning or duplicating a recordset, just disconnect the activeconnection and reconnect and use updatebatch. Then you have the recordset without the open database connection.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

705 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