Problems adding records to dynamic recordset 
Author Message
 Problems adding records to dynamic recordset

I need to find a way to create a "dummy" recordset, populate it and
then sort it on one or more fields using server-side VBScript/ASP.  I
can create the recordset, and append fields to it without a hitch.
However, when I use the addnew method, the record never "appears", the
recordcount indicates that a record exists (recordcount = 1) but the
fields are all empty.  The information that I'm populating the fields
with are taken from the recordsets created by multiple COM objects so I
can't change the way the information is generated (read: stored
procedures).  This is what I have so far:

=======================================================================

<%
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4

'---- CursorLocationEnum Values ----
Const adUseClient = 1
Const adUseServer = 2
Const adUseClientBatch = 3

Set rsDUMMY = Server.CreateObject ("ADODB.RecordSet")
rsDUMMY.Fields.Append "EmployeeID", adVarChar, 11
rsDUMMY.Fields.Append "PadCountTimeStamp", adVarChar, 19
rsDUMMY.Fields.Append "PadNumber", adVarChar, 11
rsDUMMY.Fields.Append "SheetNumber", adVarChar, 11
rsDUMMY.Fields.Append "Sequence", adVarChar, 2

rsDUMMY.Open,,adOpenDynamic, adLockOptimistic

rsDUMMY.AddNew
rsDUMMY("EmployeeID") = "1"
rsDUMMY("PadCountTimeStamp") = "0000000000000000x0"
rsDUMMY("PadNumber") = "12"
rsDUMMY("SheetNumber") = "13"
rsDUMMY("Sequence") = "1"
rsDUMMY.Update
rsDUMMY.MoveLast

Response.Write (rsDUMMY.Fields.Count & " fields in recordset<BR><BR>")
For i = 0 to (rsDUMMY.Fields.Count - 1)
Response.Write (rsDUMMY.Fields.Item(i).Name & "<BR>") Next
Response.Write ("<BR>" & rsDUMMY.RecordCount & " record(s)<BR><BR>") If
rsDUMMY.RecordCount > 0 Then
rsDUMMY.MoveFirst
Response.Write ("EmployeeID = & rsDUMMY("EmployeeID") & "<BR>") End If

'sort rsDUMMY here

rsDUMMY.Close
Set rsDUMMY = Nothing
%>
<HTML>
<BODY>
<!-- insert something here -->
</BODY>
</HTML>

=======================================================================

If anyone has any advise or can point out what I'm doing wrong, please
pass it on.

TIA

Andy Evans

Sent via Deja.com http://www.***.com/
Share what you know. Learn what you don't.



Sun, 06 Jan 2002 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Problem adding new record to SQL database recordset

2. Problem adding new record to inner join recordset...

3. Problem adding new record to inner join recordset...

4. Problems with adding new records in a recordset

5. open a recordset for adding records only

6. Adding record to Recordset using INSERT.

7. Recordset in SQL, adding, updating and deleting records???

8. Add New Record to Master/Index Recordset

9. add record to disconnected shaped recordsets' child

10. adding a new record to Recordset in ADO

11. Adding record/Disconnected recordset

12. Adding Record to Recordset


 
Powered by phpBB® Forum Software