Creating a Recordset


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Creating a Recordset

Hybrid View

  1. #1
    Scott Guest

    Creating a Recordset


    Does anyone know how to create a recordset.

    I am trying to Passing into a DLL a recordset. I want to be able to create
    this recordset on the fly and am having trouble.

    Here is what I have been testing with

    Rst.Fields.Append "Fld1", adNumeric, , , 12

    I can add a field (Fld1 and the correct data type), but I can't seem to be
    able to add a value (12 is the test value).

    Documentation says that I don't need to have the recordset open and connected
    to a database to do this and since I am creating a recordset based on user
    information. The client side recordset should be detached from the database
    while the user is creating this records. I want to be able to pass this
    recordset into a DataAccess DLL and let the DLL worry about updating or inserting
    into the Database.

    This will allow the Application to expand the Database columns and very little
    code will have to change on the client side.



  2. #2
    Arthur Wood Guest

    Re: Creating a Recordset


    Scott:
    try this:

    rst.Fields.Append "fld1", adInteger
    rst.Fields.Append "fld2", adDate
    rst.Fields.Append "fld3", adSingle
    rst.Fields.Append "fld4", adInteger
    ' must OPEN the recordset object, in order to work with it
    rst.Open
    ' since this is created on the fly, must AddNew to add a New record
    rst.AddNew
    'now you can add data to the fields
    rst("fld1") = 12
    rst("fld2") = Now()
    rst("fld3") = 1.05
    rst("fld4") = 78


    is this what you had in mind?

    Arthur Wood


    "Scott" <srr@gksys.com> wrote:
    >
    >Does anyone know how to create a recordset.
    >
    >I am trying to Passing into a DLL a recordset. I want to be able to create
    >this recordset on the fly and am having trouble.
    >
    >Here is what I have been testing with
    >
    >Rst.Fields.Append "Fld1", adNumeric, , , 12
    >
    >I can add a field (Fld1 and the correct data type), but I can't seem to

    be
    >able to add a value (12 is the test value).
    >
    >Documentation says that I don't need to have the recordset open and connected
    >to a database to do this and since I am creating a recordset based on user
    >information. The client side recordset should be detached from the database
    >while the user is creating this records. I want to be able to pass this
    >recordset into a DataAccess DLL and let the DLL worry about updating or

    inserting
    >into the Database.
    >
    >This will allow the Application to expand the Database columns and very

    little
    >code will have to change on the client side.
    >
    >



  3. #3
    Paul Clement Guest

    Re: Creating a Recordset

    On 7 Nov 2001 16:11:32 GMT, "Scott" <srr@gksys.com> wrote:


    Does anyone know how to create a recordset.

    I am trying to Passing into a DLL a recordset. I want to be able to create
    this recordset on the fly and am having trouble.

    Here is what I have been testing with

    Rst.Fields.Append "Fld1", adNumeric, , , 12

    I can add a field (Fld1 and the correct data type), but I can't seem to be
    able to add a value (12 is the test value).

    I only see four arguments for Append and none of them allow you to add a value.

    If you want to add a row with field/column values you need to use the AddNew and Update methods of
    the Recordset (connected or disconnected).


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center