how to create recordset from my session variables?

They have: 12 posts

Joined: Mar 2002

I need to create a recordset from a number of session variables. After I create this recordset I will be passing it to a stored procedure.

Could someone please tell me how to create the recordset? I'm not asking how to GET a recordset from a database. I need to know how to create one: create fieldnames and put data into each field.

Thank you for assistance!

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

It's not much different, you still have to create your recordset:

Set MyRS = Server.CreateObject(ADODB.RecordSet)

Then create your fields:

With MyRS
.Fields.Append "FieldOne", adInteger
.Fields.Append "FieldTwo", adInteger
End With

Then populate your fields:

With MyRS
.Open
.AddNew
.Fields.Item("FieldOne") = 64
.Fields.Item("FieldTwo") = 128
.Update
.MoveNext
End With

Hope that helps. You should consider just passing everything to the sproc and skip creating the recordset if possible.

PJ | Are we there yet?
pjboettcher.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.