ADO RecordSets in Memory
Keywords: ADO RecordSets in Memory
Here is a script that lists the constants for possible field types, and lets you type in an integer value for the third field.Below are listed out the data types for fields in an ADO Recordset The Script creates a RecordSet in 'memory', and appends two fields It then asks input for a third field type enter one of the values below
If successful, the field will be added and some sample data saved to a file called memory.xml.
Stan Littlefield 8/5/2000
;Winbatch Testing RecordSet Fields ;---- DataTypeEnum Values ---- ; adEmpty = 0 ; adTinyInt = 16 ; adSmallInt = 2 ; adInteger = 3 ; adBigInt = 20 ; adUnsignedTinyInt = 17 ; adUnsignedSmallInt = 18 ; adUnsignedInt = 19 ; adUnsignedBigInt = 21 ; adSingle = 4 ; adDouble = 5 ; adCurrency = 6 ; adDecimal = 14 ; adNumeric = 131 ; adBoolean = 11 ; adError = 10 ; adUserDefined = 132 ; adVariant = 12 ; adIDispatch = 9 ; adIUnknown = 13 ; adGUID = 72 ; adDate = 7 ; adDBDate = 133 ; adDBTime = 134 ; adDBTimeStamp = 135 ; adBSTR = 8 ; adChar = 129 ; adVarChar = 200 ; adLongVarChar = 201 ; adWChar = 130 ; adVarWChar = 202 ; adLongVarWChar = 203 ; adBinary = 128 ; adVarBinary = 204 ; adLongVarBinary = 205 ; adChapter = 136 ; adFileTime = 64 ; adPropVariant = 138 ; adVarNumeric = 139 ; adArray = &H2000 ;In my testing trying values related to Binary Fields got this error in ;the wwwbatch.ini file ;[OLE Exception] ;ADODB.Fields=Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. IF FileExist(".\Memory.xml") == @TRUE FileDelete(".\Memory.xml") Endif ;create RecordSet Object and access fields collection RS = ObjectOpen("ADODB.RecordSet") flds = RS.Fields ;add first two fields with working values, (see enums above) flds.append("ID",3) flds.append("Name",202, 35) nField = AskLine("ADO RecordSet Field Type","Enter Integer Value",202) nField = Int(nField) flds.append("Field3",nField) RS.Open() fld1 = RS.Fields("ID") fld2 = RS.Fields("Name") RS.AddNew() fld1.Value = 1000 fld2.Value = "First Record Added" RS.Update() RS.AddNew() fld1.Value = 1001 fld2.Value = "Second Record Added" RS.Update() RS.AddNew() fld1.Value = 1002 fld2.Value = "Third Record Added" RS.Update() RS.Save("Memory.xml",1) RS.Close() ObjectClose(RS) message("Recordset Saved as XML...","Memory.xml") exit
Article ID: W14667Filename: Create Recordset in Memory.txt