-
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.
-
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.
>
>
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks