Professional Web Applications Themes

RecordSet without actual data behind it - ASP Database

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 ...

  1. #1

    Default 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.Dictionary, which is great, but
    I would like to use something more similar. :) )



    Agoston Guest

  2. #2

    Default Re: RecordSet without actual data behind it

    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" <hu> a écrit dans le message de
    news:phx.gbl... 
    data 
    it? 
    least 
    but 


    Patrice Guest

  3. #3

    Default Re: RecordSet without actual data behind it

    This should answer your question:

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

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


    "Agoston Bejo" <hu> wrote in message
    news:phx.gbl... 
    data 
    it? 
    least 
    but 


    Manohar Guest

  4. #4

    Default Re: RecordSet without actual data behind it

    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" <hu> wrote in message
    news:phx.gbl... 
    data 
    it? 
    least 
    but 


    Veign Guest

  5. #5

    Default Re: RecordSet without actual data behind it

    Veign wrote: 

    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 Guest

Similar Threads

  1. Question Insert from ASP to SQL using recordset data as values in insert statement
    By JasonM in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 13th, 05:54 PM
  2. Using variables in recordset to filter data
    By saf_123 in forum Dreamweaver AppDev
    Replies: 3
    Last Post: June 30th, 04:01 PM
  3. Display or Hide Recordset Data
    By The Wackonerd in forum Dreamweaver AppDev
    Replies: 0
    Last Post: May 2nd, 05:07 AM
  4. Recordset Gone in data bindings panel.
    By doc in forum Dreamweaver AppDev
    Replies: 1
    Last Post: March 25th, 05:39 AM
  5. Passing Recordset data PHP and Mysql
    By davetheNewbie in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 28th, 01:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139