RecordSet without actual data behind it

Discussion in 'ASP General' started by Agoston Bejo, Oct 1, 2004.

  1. Agoston Bejo

    Agoston Bejo Guest

    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.Dictionary, which is great, but
    I would like to use something more similar. :) )
     
    Agoston Bejo, Oct 1, 2004
    #1
    1. Advertising

  2. Agoston Bejo

    Patrice Guest

    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" <> a écrit dans le message de
    news:...
    > 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.Dictionary, which is great,

    but
    > I would like to use something more similar. :) )
    >
    >
    >
     
    Patrice, Oct 1, 2004
    #2
    1. Advertising

  3. This should answer your question:

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

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Agoston Bejo" <> wrote in message
    news:...
    > 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.Dictionary, which is great,

    but
    > I would like to use something more similar. :) )
    >
    >
    >
     
    Manohar Kamath [MVP], Oct 1, 2004
    #3
  4. Agoston Bejo

    Veign Guest

    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
    .ActiveConnection = Nothing

    'Set for client side processing
    .CursorLocation = adUseClient

    'Single user updates
    .LockType = adLockBatchOptimistic
    End With

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

    'Open the Recordset
    RS.Open

    'Populate the Data in the Recordset
    With RS
    .AddNew
    .Fields("ID") = "ID123"
    .Fields("Company") = "Some Company"
    .Fields("Description") = "Description"
    End With
    '-------------------------End Code---------------------------


    --
    Chris Hanscom
    MVP (Visual Basic)
    http://www.veign.com
    --

    "Agoston Bejo" <> wrote in message
    news:...
    > 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.Dictionary, which is great,

    but
    > I would like to use something more similar. :) )
    >
    >
    >
     
    Veign, Oct 1, 2004
    #4
  5. Veign wrote:
    > You need to create a disconnected recordset.
    >


    Just a little nitpick:
    He actually needs to create an "ad hoc" recordset, not "disconnected", since
    "disconnected" implies that a previously connected recordset has been
    disconnected by setting the ActiveConnection 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"
     
    Bob Barrows [MVP], Oct 1, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    1,015
  2. Bart  Kastermans
    Replies:
    3
    Views:
    519
    Bart Kastermans
    Jan 25, 2008
  3. Bryan Avery
    Replies:
    6
    Views:
    175
    Bryan Avery
    Aug 7, 2003
  4. Hung Huynh
    Replies:
    8
    Views:
    317
    Bob Barrows
    Sep 24, 2003
  5. Kamarulnizam Rahim
    Replies:
    4
    Views:
    226
    Robert Klemme
    Jan 28, 2011
Loading...

Share This Page