Using a RecordSet without an ADO connection 
Author Message
 Using a RecordSet without an ADO connection

As far as I can tell, in VBS, a recordset is a return object from an
ADO database query.

However, I want to create a recordset manually, without having a
database or connection involved. I will manually populate the
recordset myself and just use it as you would an array.

Is this possible? I have tried, but it needs to be opened first.
However, the open method only works to establish a connection - I
can't just genraically move to the first record, or in this case, just
append a record.

Essentially I want to :

Set compRs = CreateObject("ADODB.Recordset")
compRs.AddNew
compRs.Fields("TAG").Value = sPITAG
compRs.Update

However, I want a recordset that isn't ADO related?

Thanks
Ryan Darby



Mon, 07 Nov 2005 09:59:46 GMT  
 Using a RecordSet without an ADO connection
'Example of needed methodology

Set ObjTemprs = CreateObject("ADODB.Recordset")
ObjTemprs.CursorType=adOpenStatic
ObjTemprs.CursorLocation=adUseClient
ObjTemprs.Fields.Append "FieldName1", adVarChar, 10
ObjTemprs.Fields.Append "FieldName2", adInteger
ObjTemprs.Open

ObjTemprs.AddNew
ObjTemprs("FieldName1") = "David"
ObjTemprs("FieldName2") = 17
ObjTemprs.Update
ObjTemprs.AddNew
ObjTemprs("FieldName1") = "Lyle"
ObjTemprs("FieldName2") = 20
ObjTemprs.Update
ObjTemprs.AddNew
ObjTemprs("FieldName1") = "Carl"
ObjTemprs("FieldName2") = 48
ObjTemprs.Update
ObjTemprs.AddNew
ObjTemprs("FieldName1") = "Zack"
ObjTemprs("FieldName2") = 8
ObjTemprs.Update
ObjTemprs.Sort = "FieldName2"
ObjTemprs.MoveFirst
Do While Not ObjTemprs.EOF
 Response.Write ObjTemprs("FieldName1") & " "
 Response.Write ObjTemprs("FieldName2") & "<br><br>"
 ObjTemprs.MoveNext
Loop

ObjTemprs.Close
Set ObjTemprs = Nothing

'---- 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 adUseServer = 2
Const adUseClient = 3

'---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135
Const adBSTR = 8
Const adChar = 129
Const adVarChar = 200
Const adLongVarChar = 201
Const adWChar = 130
Const adVarWChar = 202
Const adLongVarWChar = 203
Const adBinary = 128
Const adVarBinary = 204
Const adLongVarBinary = 205
Const adChapter = 136
Const adFileTime = 64
Const adPropVariant = 138
Const adVarNumeric = 139
Const adArray = &H2000

'---- SearchDirectionEnum Values ----
Const adSearchForward = 1
Const adSearchBackward = -1

'---- PersistFormatEnum Values ----
Const adPersistXML = 1

-------------------------------------------------
d l b j r

Unambit from meager knowledge of inane others,
engender uncharted sagacity.
-------------------------------------------------



Mon, 07 Nov 2005 10:13:48 GMT  
 Using a RecordSet without an ADO connection
http://www.4guysfromrolla.com/webtech/080101-1.shtml

HTH,
Sai Krishnakumar


Quote:
> 'Example of needed methodology

> Set ObjTemprs = CreateObject("ADODB.Recordset")
> ObjTemprs.CursorType=adOpenStatic
> ObjTemprs.CursorLocation=adUseClient
> ObjTemprs.Fields.Append "FieldName1", adVarChar, 10
> ObjTemprs.Fields.Append "FieldName2", adInteger
> ObjTemprs.Open

> ObjTemprs.AddNew
> ObjTemprs("FieldName1") = "David"
> ObjTemprs("FieldName2") = 17
> ObjTemprs.Update
> ObjTemprs.AddNew
> ObjTemprs("FieldName1") = "Lyle"
> ObjTemprs("FieldName2") = 20
> ObjTemprs.Update
> ObjTemprs.AddNew
> ObjTemprs("FieldName1") = "Carl"
> ObjTemprs("FieldName2") = 48
> ObjTemprs.Update
> ObjTemprs.AddNew
> ObjTemprs("FieldName1") = "Zack"
> ObjTemprs("FieldName2") = 8
> ObjTemprs.Update
> ObjTemprs.Sort = "FieldName2"
> ObjTemprs.MoveFirst
> Do While Not ObjTemprs.EOF
>  Response.Write ObjTemprs("FieldName1") & " "
>  Response.Write ObjTemprs("FieldName2") & "<br><br>"
>  ObjTemprs.MoveNext
> Loop

> ObjTemprs.Close
> Set ObjTemprs = Nothing

> '---- 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 adUseServer = 2
> Const adUseClient = 3

> '---- DataTypeEnum Values ----
> Const adEmpty = 0
> Const adTinyInt = 16
> Const adSmallInt = 2
> Const adInteger = 3
> Const adBigInt = 20
> Const adUnsignedTinyInt = 17
> Const adUnsignedSmallInt = 18
> Const adUnsignedInt = 19
> Const adUnsignedBigInt = 21
> Const adSingle = 4
> Const adDouble = 5
> Const adCurrency = 6
> Const adDecimal = 14
> Const adNumeric = 131
> Const adBoolean = 11
> Const adError = 10
> Const adUserDefined = 132
> Const adVariant = 12
> Const adIDispatch = 9
> Const adIUnknown = 13
> Const adGUID = 72
> Const adDate = 7
> Const adDBDate = 133
> Const adDBTime = 134
> Const adDBTimeStamp = 135
> Const adBSTR = 8
> Const adChar = 129
> Const adVarChar = 200
> Const adLongVarChar = 201
> Const adWChar = 130
> Const adVarWChar = 202
> Const adLongVarWChar = 203
> Const adBinary = 128
> Const adVarBinary = 204
> Const adLongVarBinary = 205
> Const adChapter = 136
> Const adFileTime = 64
> Const adPropVariant = 138
> Const adVarNumeric = 139
> Const adArray = &H2000

> '---- SearchDirectionEnum Values ----
> Const adSearchForward = 1
> Const adSearchBackward = -1

> '---- PersistFormatEnum Values ----
> Const adPersistXML = 1

> -------------------------------------------------
> d l b j r

> Unambit from meager knowledge of inane others,
> engender uncharted sagacity.
> -------------------------------------------------



Tue, 08 Nov 2005 04:25:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO recordset without connection

2. Using ADO WITHOUT a DB-connection

3. Detecting how many recordsets are using an ADO connection

4. max recordsets using a single ado connection

5. Unable to reuse ADO.Recordset connection using VBA script in Excel

6. Dropping ADO recordset active connection

7. Collection of ADO Recordsets and/or ADO Connections

8. How to fill a RecordSet without a connection

9. Make a recordset without a connection

10. Recordset without connection

11. ADO-Connection to Dbase without DNS

12. Resorting an Ado recordset without reopening it.

 

 
Powered by phpBB® Forum Software