473,586 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RecordSet without actual data behind it

I would like to use an ADODB.RecordSet object to temporarily store some data
and then iterate through it. Actually it needs to be a RecordSet only
because it is a perfect choice as data structure for what I want to do, I
don't want to actually run queries or update tables with it.
It seems to me, however, that the RecordSet works only if there's a query
behind it. ADO complains about the RecordSet not being open when I try to
add rows by the AddNew function, or try to add fields to it.

Is there a way to use the RecordSet without actual database date behind it?
Or is there maybe some object in VBScript that provides the same or at least
similar functionality? (Apart from Scripting.Dicti onary, which is great, but
I would like to use something more similar. :) )

Jul 19 '05 #1
4 4735
If I remember steps are :
- create the recordset
- append the fields
- open the recordset
- add data

Seesing some code that repor the problme may help...

Patrice

--

"Agoston Bejo" <gu***@freemail .hu> a écrit dans le message de
news:ee******** ******@TK2MSFTN GP15.phx.gbl...
I would like to use an ADODB.RecordSet object to temporarily store some data and then iterate through it. Actually it needs to be a RecordSet only
because it is a perfect choice as data structure for what I want to do, I
don't want to actually run queries or update tables with it.
It seems to me, however, that the RecordSet works only if there's a query
behind it. ADO complains about the RecordSet not being open when I try to
add rows by the AddNew function, or try to add fields to it.

Is there a way to use the RecordSet without actual database date behind it? Or is there maybe some object in VBScript that provides the same or at least similar functionality? (Apart from Scripting.Dicti onary, which is great, but I would like to use something more similar. :) )

Jul 19 '05 #2
This should answer your question:

http://www.4guysfromrolla.com/webtech/071799-1.shtml

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Agoston Bejo" <gu***@freemail .hu> wrote in message
news:ee******** ******@TK2MSFTN GP15.phx.gbl...
I would like to use an ADODB.RecordSet object to temporarily store some data and then iterate through it. Actually it needs to be a RecordSet only
because it is a perfect choice as data structure for what I want to do, I
don't want to actually run queries or update tables with it.
It seems to me, however, that the RecordSet works only if there's a query
behind it. ADO complains about the RecordSet not being open when I try to
add rows by the AddNew function, or try to add fields to it.

Is there a way to use the RecordSet without actual database date behind it? Or is there maybe some object in VBScript that provides the same or at least similar functionality? (Apart from Scripting.Dicti onary, which is great, but I would like to use something more similar. :) )

Jul 19 '05 #3
You need to create a disconnected recordset.

Basic structure of a disconnected recordset:

'-------------------Start Code----------------------------
'Create the Disconnected Recordset
Dim RS As Recordset
Set RS = New Recordset

'Setup the Recordset
With RS
'Make sure there is no active connection
.ActiveConnecti on = Nothing

'Set for client side processing
.CursorLocation = adUseClient

'Single user updates
.LockType = adLockBatchOpti mistic
End With

'Add Fields and Values to Recordset
With RS.Fields
.Append "ID", adBSTR
.Append "Company", adBSTR
.Append "Descriptio n", adBSTR
End With

'Open the Recordset
RS.Open

'Populate the Data in the Recordset
With RS
.AddNew
.Fields("ID") = "ID123"
.Fields("Compan y") = "Some Company"
.Fields("Descri ption") = "Descriptio n"
End With
'-------------------------End Code---------------------------
--
Chris Hanscom
MVP (Visual Basic)
http://www.veign.com
--

"Agoston Bejo" <gu***@freemail .hu> wrote in message
news:ee******** ******@TK2MSFTN GP15.phx.gbl...
I would like to use an ADODB.RecordSet object to temporarily store some data and then iterate through it. Actually it needs to be a RecordSet only
because it is a perfect choice as data structure for what I want to do, I
don't want to actually run queries or update tables with it.
It seems to me, however, that the RecordSet works only if there's a query
behind it. ADO complains about the RecordSet not being open when I try to
add rows by the AddNew function, or try to add fields to it.

Is there a way to use the RecordSet without actual database date behind it? Or is there maybe some object in VBScript that provides the same or at least similar functionality? (Apart from Scripting.Dicti onary, which is great, but I would like to use something more similar. :) )

Jul 19 '05 #4
Veign wrote:
You need to create a disconnected recordset.


Just a little nitpick:
He actually needs to create an "ad hoc" recordset, not "disconnect ed", since
"disconnect ed" implies that a previously connected recordset has been
disconnected by setting the ActiveConnectio n property to Nothing. A
disconnected recordset can be reconnected to the data source. An ad hoc
recordset, since it never was connected to a data source, cannot be
connected after it is open.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
9305
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not recognise datasets and requires a recordset. Can the datatypes be converted? At the Classic ASP end or .NET end? Can SOAP toolkit provide the...
2
10674
by: Roland Hall | last post by:
I have two(2) issues. I'm experiencing a little difficulty and having to resort to a work around. I already found one bug, although stated the bug was only in ODBC, which I'm not using. It appears to be in the OLEDB driver also. My connection was: conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & ";" & "Extended...
1
2468
by: Edward | last post by:
I've recently migrated the back end of one of my client's applications from Access to SQL Server. One of the forms is based on an Access query thus: SELECT dbo_tblDistributionDetail.*, dbo_tblDistributionMaster.fldDocumentType, dbo_tblDistributionMaster.fldDocumentID, dbo_tblDistributionMaster.ts FROM dbo_tblDistributionMaster INNER JOIN...
6
13992
by: Andy Barber | last post by:
Hi, I'm trying to write an app that reads data from a table into a string variable for later use in my program. Below is a snippet of the code I'm using, which compiles ok, but at runtime I get and error 'Object reference not set to an instance of an object.' as soon as I try to access the data in the fields, I.e. at the line that reads...
36
4445
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a dataview with a count = 0. Can someone explain why and how I might work around this problem? Here is the code for my function: Public Shared...
5
3040
by: slowmotiongenius | last post by:
All- I have established an adodb recordset in my code-behind, and I need to pass it to the aspx file. I can't seem to figure out if there is a way to do this. I see you can pass a string over using the GetCallbackResult, but a recordset won't pass this way. Any ideas??? Thanks
6
1625
by: AJ | last post by:
Hi all, I am trying to execute the following code: 'create recordset object SET recData = Server.CreateObject("ADODB.recordset") 'open recordset recData.Open "exec GetExhibitorsSearchByName 20,38916,38916,'do'", DataConn, 3, 3
4
1506
by: Joseph | last post by:
Hi all- I am a former VB6 programmer and new at C# and I have a question dealing with converting some code from VB6 to C#. The code is below and essentially, what it does is gets data from a SQL Server database and parses some of the data and puts the parsed data into a text field. I omitted a some of the code and left the data parsing part...
5
1598
by: joe donnelly | last post by:
I have a couple of questions about recordsets: 1. When a recordset is summoned by the code where does it actually exist and in what form...is it created in the database (data source location) as a new table that mimics the actual database table and contains the fields and rows asked for in the query? It is somewhat vague as to it's true...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.