Look at this data issue: Double Precision

Discussion in 'ASP General' started by katrinaVictim@., Nov 17, 2005.

  1. Please copy and paste the full code source into any .asp page and pull
    the page from the browser. Make sure all components are up to date.

    Explain why number1 is treated differently than number2 when converted
    to XML...

    Any specific answers?


    <%@ Language=VBScript %>
    <%Response.Buffer = true %>

    <%
    ' ---------------------------------------------------
    ' The full complete constantfile
    ' for
    ' ActiveX Data Object Version 2.1
    '
    ' Written by
    ' Andreas Kviby
    ' Devphiles AB, Sweden
    '
    ' http://www.devphiles.com
    '
    ' Send your comments to
    '
    ' ---------------------------------------------------'
    ' ADODB.CursorOptionEnum
    Const adAddNew = 16778240
    Const adApproxPosition = 16384
    Const adBookmark = 8192
    Const adDelete = 16779264
    Const adFind = 524288
    Const adHoldRecords = 256
    Const adIndex = 8388608
    Const adMovePrevious = 512
    Const adNotify = 262144
    Const adResync = 131072
    Const adSeek = 4194304
    Const adUpdate = 16809984
    Const adUpdateBatch = 65536

    ' ADODB.CursorLocationEnum
    Const adUseClient = 3
    Const adUseServer = 2

    ' ADODB.CursorTypeEnum
    Const adOpenDynamic = 2
    Const adOpenForwardOnly = 0
    Const adOpenKeyset = 1
    Const adOpenStatic = 3

    ' ADODB.AffectEnum
    Const adAffectAllChapters = 4
    Const adAffectCurrent = 1
    Const adAffectGroup = 2

    ' ADODB.ConnectOptionEnum
    Const adAsyncConnect = 16

    ' ADODB.ConnectModeEnum
    Const adModeRead = 1
    Const adModeReadWrite = 3
    Const adModeShareDenyNone = 16
    Const adModeShareDenyRead = 4
    Const adModeShareDenyWrite = 8
    Const adModeShareExclusive = 12
    Const adModeUnknown = 0
    Const adModeWrite = 2

    ' ADODB.ConnectPromptEnum
    Const adPromptAlways = 1
    Const adPromptComplete = 2
    Const adPromptCompleteRequired = 3
    Const adPromptNever = 4

    ' ADODB.ExecuteOptionEnum
    Const adAsyncExecute = 16
    Const adAsyncFetch = 32
    Const adAsyncFetchNonBlocking = 64
    Const adExecuteNoRecords = 128

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

    ' ADODB.BookmarkEnum
    Const adBookmarkCurrent = 0
    Const adBookmarkFirst = 1
    Const adBookmarkLast = 2

    ' ADODB.StringFormatEnum
    Const adClipString = 2

    ' ADODB.CommandTypeEnum
    Const adCmdFile = 256
    Const adCmdStoredProc = 4
    Const adCmdTable = 2
    Const adCmdTableDirect = 512
    Const adCmdText = 1
    Const adCmdUnknown = 8

    ' ADODB.CompareEnum
    Const adCompareEqual = 1
    Const adCompareGreaterThan = 2
    Const adCompareLessThan = 0
    Const adCompareNotComparable = 4
    Const adCompareNotEqual = 3

    ' ADODB.ADCPROP_UPDATECRITERIA_ENUM
    Const adCriteriaAllCols = 1
    Const adCriteriaKey = 0
    Const adCriteriaTimeStamp = 3
    Const adCriteriaUpdCols = 2

    ' ADODB.ADCPROP_ASYNCTHREADPRIORITY_ENUM
    Const adPriorityAboveNormal = 4
    Const adPriorityBelowNormal = 2
    Const adPriorityHighest = 5
    Const adPriorityLowest = 1
    Const adPriorityNormal = 3

    ' ADODB.EditModeEnum
    Const adEditAdd = 2
    Const adEditDelete = 4
    Const adEditInProgress = 1
    Const adEditNone = 0

    ' ADODB.ErrorValueEnum
    Const adErrBoundToCommand = 3707
    Const adErrDataConversion = 3421
    Const adErrFeatureNotAvailable = 3251
    Const adErrIllegalOperation = 3219
    Const adErrInTransaction = 3246
    Const adErrInvalidArgument = 3001
    Const adErrInvalidConnection = 3709
    Const adErrInvalidParamInfo = 3708
    Const adErrItemNotFound = 3265
    Const adErrNoCurrentRecord = 3021
    Const adErrNotReentrant = 3710
    Const adErrObjectClosed = 3704
    Const adErrObjectInCollection = 3367
    Const adErrObjectNotSet = 3420
    Const adErrObjectOpen = 3705
    Const adErrOperationCancelled = 3712
    Const adErrProviderNotFound = 3706
    Const adErrStillConnecting = 3713
    Const adErrStillExecuting = 3711
    Const adErrUnsafeOperation = 3716

    ' ADODB.FilterGroupEnum
    Const adFilterAffectedRecords = 2
    Const adFilterConflictingRecords = 5
    Const adFilterFetchedRecords = 3
    Const adFilterNone = 0
    Const adFilterPendingRecords = 1

    ' ADODB.FieldAttributeEnum
    Const adFldCacheDeferred = 4096
    Const adFldFixed = 16
    Const adFldIsNullable = 32
    Const adFldKeyColumn = 32768
    Const adFldLong = 128
    Const adFldMayBeNull = 64
    Const adFldMayDefer = 2
    Const adFldNegativeScale = 16384
    Const adFldRowID = 256
    Const adFldRowVersion = 512
    Const adFldUnknownUpdatable = 8
    Const adFldUpdatable = 4

    ' ADODB.GetRowsOptionEnum
    Const adGetRowsRest = -1

    ' ADODB.LockTypeEnum
    Const adLockBatchOptimistic = 4
    Const adLockOptimistic = 3
    Const adLockPessimistic = 2
    Const adLockReadOnly = 1

    ' ADODB.MarschalOptionsEnum
    Const adMarshalAll = 0
    Const adMarshalModifiedOnly = 1

    ' ADODB.ParameterDirectionEnum
    Const adParamInput = 1
    Const adParamInputOutput = 3
    Const adParamOutput = 2
    Const adParamReturnValue = 4
    Const adParamUnknown = 0

    ' ADODB.ParameterAttributesEnum
    Const adParamLong = 128
    Const adParamNullable = 64
    Const adParamSigned = 16

    ' ADODB.PersistFormatEnum
    Const adPersistADTG = 0
    Const adPersistXML = 1

    ' ADODB.PositionEnum
    Const adPosBOF = -2
    Const adPosEOF = -3
    Const adPosUnknown = -1

    ' ADODB.PropertyAttributesEnum
    Const adPropNotSupported = 0
    Const adPropOptional = 2
    Const adPropRead = 512
    Const adPropRequired = 1
    Const adPropWrite = 1024

    ' ADODB.ADCPROP_AUTORECALC_ENUM
    Const adRecalcAlways = 1
    Const adRecalcUpFront = 0

    ' ADODB.RecordStatusEnum
    Const adRecCanceled = 256
    Const adRecCantRelease = 1024
    Const adRecConcurrencyViolation = 2048
    Const adRecDBDeleted = 262144
    Const adRecDeleted = 4
    Const adRecIntegrityViolation = 4096
    Const adRecInvalid = 16
    Const adRecMaxChangesExceeded = 8192
    Const adRecModified = 2
    Const adRecMultipleChanges = 64
    Const adRecNew = 1
    Const adRecObjectOpen = 16384
    Const adRecOK = 0
    Const adRecOutOfMemory = 32768
    Const adRecPendingChanges = 128
    Const adRecPermissionDenied = 65536
    Const adRecSchemaViolation = 131072
    Const adRecUnmodified = 8

    ' ADODB.CEResyncEnum
    Const adResyncAll = 15
    Const adResyncAutoIncrement = 1
    Const adResyncConflicts = 2
    Const adResyncInserts = 8
    Const adResyncNone = 0
    Const adResyncUpdates = 4

    ' ADODB.ResyncEnum
    Const adResyncAllValues = 2
    Const adResyncUnderlyingValues = 1

    ' ADODB.EventReasonEnum
    Const adRsnAddNew = 1
    Const adRsnClose = 9
    Const adRsnDelete = 2
    Const adRsnFirstChange = 11
    Const adRsnMove = 10
    Const adRsnMoveFirst = 12
    Const adRsnMoveLast = 15
    Const adRsnMoveNext = 13
    Const adRsnMovePrevious = 14
    Const adRsnRequery = 7
    Const adRsnResynch = 8
    Const adRsnUndoAddNew = 5
    Const adRsnUndoDelete = 6
    Const adRsnUndoUpdate = 4
    Const adRsnUpdate = 3

    ' ADODB.SchemaEnum
    Const adSchemaAsserts = 0
    Const adSchemaCatalogs = 1
    Const adSchemaCharacterSets = 2
    Const adSchemaCheckConstraints = 5
    Const adSchemaCollations = 3
    Const adSchemaColumnPrivileges = 13
    Const adSchemaColumns = 4
    Const adSchemaColumnsDomainUsage = 11
    Const adSchemaConstraintColumnUsage = 6
    Const adSchemaConstraintTableUsage = 7
    Const adSchemaCubes = 32
    Const adSchemaDBInfoKeywords = 30
    Const adSchemaDBInfoLiterals = 31
    Const adSchemaDimensions = 33
    Const adSchemaForeignKeys = 27
    Const adSchemaHierarchies = 34
    Const adSchemaIndexes = 12
    Const adSchemaKeyColumnUsage = 8
    Const adSchemaLevels = 35
    Const adSchemaMeasures = 36
    Const adSchemaMembers = 38
    Const adSchemaPrimaryKeys = 28
    Const adSchemaProcedureColumns = 29
    Const adSchemaProcedureParameters = 26
    Const adSchemaProcedures = 16
    Const adSchemaProperties = 37
    Const adSchemaProviderSpecific = -1
    Const adSchemaProviderTypes = 22
    Const adSchemaReferentialConstraints = 9
    Const adSchemaSchemata = 17
    Const adSchemaSQLLanguages = 18
    Const adSchemaStatistics = 19
    Const adSchemaTableConstraints = 10
    Const adSchemaTablePrivileges = 14
    Const adSchemaTables = 20
    Const adSchemaTranslations = 21
    Const adSchemaTrustees = 39
    Const adSchemaUsagePrivileges = 15
    Const adSchemaViewColumnUsage = 24
    Const adSchemaViews = 23
    Const adSchemaViewTableUsage = 25

    ' ADODB.SearchDirectionEnum
    Const adSearchBackward = -1
    Const adSearchForward = 1

    ' ADODB.SeekEnum
    Const adSeekAfter = 8
    Const adSeekAfterEQ = 4
    Const adSeekBefore = 32
    Const adSeekBeforeEQ = 16
    Const adSeekFirstEQ = 1
    Const adSeekLastEQ = 2

    ' ADODB.ObjectStateEnum
    Const adStateClosed = 0
    Const adStateConnecting = 2
    Const adStateExecuting = 4
    Const adStateFetching = 8
    Const adStateOpen = 1

    ' ADODB.EventStatusEnum
    Const adStatusCancel = 4
    Const adStatusCantDeny = 3
    Const adStatusErrorsOccurred = 2
    Const adStatusOK = 1
    Const adStatusUnwantedEvent = 5

    ' ADODB.XactAttributeEnum
    Const adXactAbortRetaining = 262144
    Const adXactCommitRetaining = 131072

    ' ADODB.IsolationLevelEnum
    Const adXactBrowse = 256
    Const adXactChaos = 16
    Const adXactCursorStability = 4096
    Const adXactIsolated = 1048576
    Const adXactReadCommitted = 4096
    Const adXactReadUncommitted = 256
    Const adXactRepeatableRead = 65536
    Const adXactSerializable = 1048576
    Const adXactUnspecified = -1
    %>

    <%
    Set orderFObj = Server.CreateObject("scripting.dictionary")
    orderFObj.Add "number1", 100000.01
    orderFObj.Add "number2", 1000000.01

    Call listDatadic(orderFObj)
    xml = Dic2XML(orderFObj)

    response.Write(server.HTMLEncode(xml))

    Set orderFObj = nothing
    %>



    <%
    Function Dic2XML(orderFObj)
    Dim rsx
    Set Stream = Server.CreateObject("adodb.stream")
    Set rsx = Server.CreateObject("adodb.recordset")

    With rsx
    .Fields.Append "key", adVarChar, 80, adFldMayBeNull
    .Fields.Append "value", adVarChar, 80, adFldMayBeNull
    End With

    rsx.Open


    If orderFObj.count > 0 then
    For each key in orderFObj
    rsx.AddNew
    rsx("key") = key
    rsx("value") = orderFObj(key)
    rsx.Update
    Next
    end if

    rsx.Save stream, adPersistXML
    Dic2XML = Stream.ReadText

    Set dataDic = nothing
    Set rsx = nothing
    Set Stream = nothing

    End Function
    %>

    <%Function listDatadic(dic)%>
    <%for each item in dic%>
    key-><%=item%> value-><%=dic(item)%><BR>
    <%next%>
    <%End Function%>
    katrinaVictim@., Nov 17, 2005
    #1
    1. Advertising

  2. katrinaVictim@. wrote:

    Frankly, I'm a little put off with this. I have no way of knowing whether or
    not you really are a "victim", and frankly, the attempt to capitalize on
    that tragedy in the hopes of making us a little more sympathetic to your
    issue makes me a little uneasy.

    > Please copy and paste the full code source into any .asp page and pull
    > the page from the browser. Make sure all components are up to date.


    Excuse me? You are the one asking for help. Why are you making me go to all
    this trouble in order to help you?
    All you needed to do was show us the code followed by the output you were
    puzzled about.

    >
    > Explain why number1 is treated differently than number2 when converted
    > to XML...
    >
    > Any specific answers?


    I already suspect (given the subject line) I know what the answer will be,
    but, off I go to run your code to verify my suspicions ...

    >
    >
    > <%@ Language=VBScript %>
    > <%Response.Buffer = true %>
    >
    > <%
    > ' ---------------------------------------------------
    > ' The full complete constantfile
    > ' for
    > ' ActiveX Data Object Version 2.1


    Instead of bloating your asp file with all these unneeded constants (if you
    are going to do this, why not use a SSI?), use the ADO type library:

    http://www.aspfaq.com/show.asp?id=2112

    <snip>

    I don't see why you are going through this business of adding the values
    first to a dictionary, then to a recordset, then to a stream, and then
    finally to XML when you could more simply add them directly to an XML
    document, like this:

    Function CreateXML(orderFObj)
    dim xmldoc, root, node
    If orderFObj.count > 0 then
    set xmldoc=createobject("msxml2.domdocument")
    set root=xmldoc.createElement("data")
    set xmldoc.documentElement=root
    For each key in orderFObj
    set node=xmldoc.createElement(key)
    node.text= orderFObj(key)
    root.appendchild node
    Next
    CreateXML=xmldoc.xml
    else
    CreateXML="<nodata />"
    end if
    End Function

    but I'm sure you have your reasons ....

    Anyways what you are seeing is the consequence of the imprecision in storing
    floating numbers in binary. See http://support.microsoft.com/kb/q42980/

    See the difference if you use a decimal datatype to store the value in the
    recordset, instead of allowing ADO to treat the value as a float:

    With rsx
    .Fields.Append "key", adVarChar, 80, adFldMayBeNull
    .Fields.Append "value", adDecimal, , adFldMayBeNull
    set fld=.Fields(1)
    fld.precision=10
    fld.numericscale=2
    End With

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Nov 17, 2005
    #2
    1. Advertising

  3. katrinaVictim@.

    ftq@. Guest

    On Wed, 16 Nov 2005 20:45:36 -0600, katrinaVictim@. wrote:

    As a side NOTE:

    A separate discussion of this issue can be found in archives at the
    link below. Note the last post in the thread from David Baldi; he
    says, "the stream is just an intermediate form".

    http://groups.google.com/group/micr... Stream changes float values#b76cabdea4c9d6c8

    Notice that when running the test code below, before using
    stream.readtext, rsx("value").Type will return "200", just as using
    the vartype() function on rsx("value") returns "8", both of which are
    "string" types.


    >Please copy and paste the full code source into any .asp page and pull
    >the page from the browser. Make sure all components are up to date.
    >
    >Explain why number1 is treated differently than number2 when converted
    >to XML...
    >
    >Any specific answers?
    >
    >
    ><%@ Language=VBScript %>
    ><%Response.Buffer = true %>
    >
    ><%
    >' ---------------------------------------------------
    >' The full complete constantfile
    >' for
    >' ActiveX Data Object Version 2.1
    >'
    >' Written by
    >' Andreas Kviby
    >' Devphiles AB, Sweden
    >'
    >' http://www.devphiles.com
    >'
    >' Send your comments to
    >'
    >' ---------------------------------------------------'
    >' ADODB.CursorOptionEnum
    >Const adAddNew = 16778240
    >Const adApproxPosition = 16384
    >Const adBookmark = 8192
    >Const adDelete = 16779264
    >Const adFind = 524288
    >Const adHoldRecords = 256
    >Const adIndex = 8388608
    >Const adMovePrevious = 512
    >Const adNotify = 262144
    >Const adResync = 131072
    >Const adSeek = 4194304
    >Const adUpdate = 16809984
    >Const adUpdateBatch = 65536
    >
    >' ADODB.CursorLocationEnum
    >Const adUseClient = 3
    >Const adUseServer = 2
    >
    >' ADODB.CursorTypeEnum
    >Const adOpenDynamic = 2
    >Const adOpenForwardOnly = 0
    >Const adOpenKeyset = 1
    >Const adOpenStatic = 3
    >
    >' ADODB.AffectEnum
    >Const adAffectAllChapters = 4
    >Const adAffectCurrent = 1
    >Const adAffectGroup = 2
    >
    >' ADODB.ConnectOptionEnum
    >Const adAsyncConnect = 16
    >
    >' ADODB.ConnectModeEnum
    >Const adModeRead = 1
    >Const adModeReadWrite = 3
    >Const adModeShareDenyNone = 16
    >Const adModeShareDenyRead = 4
    >Const adModeShareDenyWrite = 8
    >Const adModeShareExclusive = 12
    >Const adModeUnknown = 0
    >Const adModeWrite = 2
    >
    >' ADODB.ConnectPromptEnum
    >Const adPromptAlways = 1
    >Const adPromptComplete = 2
    >Const adPromptCompleteRequired = 3
    >Const adPromptNever = 4
    >
    >' ADODB.ExecuteOptionEnum
    >Const adAsyncExecute = 16
    >Const adAsyncFetch = 32
    >Const adAsyncFetchNonBlocking = 64
    >Const adExecuteNoRecords = 128
    >
    >' ADODB.DataTypeEnum
    >Const adBigInt = 20
    >Const adBinary = 128
    >Const adBoolean = 11
    >Const adBSTR = 8
    >Const adChapter = 136
    >Const adChar = 129
    >Const adCurrency = 6
    >Const adDate = 7
    >Const adDBDate = 133
    >Const adDBFileTime = 137
    >Const adDBTime = 134
    >Const adDBTimeStamp = 135
    >Const adDecimal = 14
    >Const adDouble = 5
    >Const adEmpty = 0
    >Const adError = 10
    >Const adFileTime = 64
    >Const adGUID = 72
    >Const adIDispatch = 9
    >Const adInteger = 3
    >Const adIUnknown = 13
    >Const adLongVarBinary = 205
    >Const adLongVarChar = 201
    >Const adLongVarWChar = 203
    >Const adNumeric = 131
    >Const adPropVariant = 138
    >Const adSingle = 4
    >Const adSmallInt = 2
    >Const adTinyInt = 16
    >Const adUnsignedBigInt = 21
    >Const adUnsignedInt = 19
    >Const adUnsignedSmallInt = 18
    >Const adUnsignedTinyInt = 17
    >Const adUserDefined = 132
    >Const adVarBinary = 204
    >Const adVarChar = 200
    >Const adVariant = 12
    >Const adVarNumeric = 139
    >Const adVarWChar = 202
    >Const adWChar = 130
    >
    >' ADODB.BookmarkEnum
    >Const adBookmarkCurrent = 0
    >Const adBookmarkFirst = 1
    >Const adBookmarkLast = 2
    >
    >' ADODB.StringFormatEnum
    >Const adClipString = 2
    >
    >' ADODB.CommandTypeEnum
    >Const adCmdFile = 256
    >Const adCmdStoredProc = 4
    >Const adCmdTable = 2
    >Const adCmdTableDirect = 512
    >Const adCmdText = 1
    >Const adCmdUnknown = 8
    >
    >' ADODB.CompareEnum
    >Const adCompareEqual = 1
    >Const adCompareGreaterThan = 2
    >Const adCompareLessThan = 0
    >Const adCompareNotComparable = 4
    >Const adCompareNotEqual = 3
    >
    >' ADODB.ADCPROP_UPDATECRITERIA_ENUM
    >Const adCriteriaAllCols = 1
    >Const adCriteriaKey = 0
    >Const adCriteriaTimeStamp = 3
    >Const adCriteriaUpdCols = 2
    >
    >' ADODB.ADCPROP_ASYNCTHREADPRIORITY_ENUM
    >Const adPriorityAboveNormal = 4
    >Const adPriorityBelowNormal = 2
    >Const adPriorityHighest = 5
    >Const adPriorityLowest = 1
    >Const adPriorityNormal = 3
    >
    >' ADODB.EditModeEnum
    >Const adEditAdd = 2
    >Const adEditDelete = 4
    >Const adEditInProgress = 1
    >Const adEditNone = 0
    >
    >' ADODB.ErrorValueEnum
    >Const adErrBoundToCommand = 3707
    >Const adErrDataConversion = 3421
    >Const adErrFeatureNotAvailable = 3251
    >Const adErrIllegalOperation = 3219
    >Const adErrInTransaction = 3246
    >Const adErrInvalidArgument = 3001
    >Const adErrInvalidConnection = 3709
    >Const adErrInvalidParamInfo = 3708
    >Const adErrItemNotFound = 3265
    >Const adErrNoCurrentRecord = 3021
    >Const adErrNotReentrant = 3710
    >Const adErrObjectClosed = 3704
    >Const adErrObjectInCollection = 3367
    >Const adErrObjectNotSet = 3420
    >Const adErrObjectOpen = 3705
    >Const adErrOperationCancelled = 3712
    >Const adErrProviderNotFound = 3706
    >Const adErrStillConnecting = 3713
    >Const adErrStillExecuting = 3711
    >Const adErrUnsafeOperation = 3716
    >
    >' ADODB.FilterGroupEnum
    >Const adFilterAffectedRecords = 2
    >Const adFilterConflictingRecords = 5
    >Const adFilterFetchedRecords = 3
    >Const adFilterNone = 0
    >Const adFilterPendingRecords = 1
    >
    >' ADODB.FieldAttributeEnum
    >Const adFldCacheDeferred = 4096
    >Const adFldFixed = 16
    >Const adFldIsNullable = 32
    >Const adFldKeyColumn = 32768
    >Const adFldLong = 128
    >Const adFldMayBeNull = 64
    >Const adFldMayDefer = 2
    >Const adFldNegativeScale = 16384
    >Const adFldRowID = 256
    >Const adFldRowVersion = 512
    >Const adFldUnknownUpdatable = 8
    >Const adFldUpdatable = 4
    >
    >' ADODB.GetRowsOptionEnum
    >Const adGetRowsRest = -1
    >
    >' ADODB.LockTypeEnum
    >Const adLockBatchOptimistic = 4
    >Const adLockOptimistic = 3
    >Const adLockPessimistic = 2
    >Const adLockReadOnly = 1
    >
    >' ADODB.MarschalOptionsEnum
    >Const adMarshalAll = 0
    >Const adMarshalModifiedOnly = 1
    >
    >' ADODB.ParameterDirectionEnum
    >Const adParamInput = 1
    >Const adParamInputOutput = 3
    >Const adParamOutput = 2
    >Const adParamReturnValue = 4
    >Const adParamUnknown = 0
    >
    >' ADODB.ParameterAttributesEnum
    >Const adParamLong = 128
    >Const adParamNullable = 64
    >Const adParamSigned = 16
    >
    >' ADODB.PersistFormatEnum
    >Const adPersistADTG = 0
    >Const adPersistXML = 1
    >
    >' ADODB.PositionEnum
    >Const adPosBOF = -2
    >Const adPosEOF = -3
    >Const adPosUnknown = -1
    >
    >' ADODB.PropertyAttributesEnum
    >Const adPropNotSupported = 0
    >Const adPropOptional = 2
    >Const adPropRead = 512
    >Const adPropRequired = 1
    >Const adPropWrite = 1024
    >
    >' ADODB.ADCPROP_AUTORECALC_ENUM
    >Const adRecalcAlways = 1
    >Const adRecalcUpFront = 0
    >
    >' ADODB.RecordStatusEnum
    >Const adRecCanceled = 256
    >Const adRecCantRelease = 1024
    >Const adRecConcurrencyViolation = 2048
    >Const adRecDBDeleted = 262144
    >Const adRecDeleted = 4
    >Const adRecIntegrityViolation = 4096
    >Const adRecInvalid = 16
    >Const adRecMaxChangesExceeded = 8192
    >Const adRecModified = 2
    >Const adRecMultipleChanges = 64
    >Const adRecNew = 1
    >Const adRecObjectOpen = 16384
    >Const adRecOK = 0
    >Const adRecOutOfMemory = 32768
    >Const adRecPendingChanges = 128
    >Const adRecPermissionDenied = 65536
    >Const adRecSchemaViolation = 131072
    >Const adRecUnmodified = 8
    >
    >' ADODB.CEResyncEnum
    >Const adResyncAll = 15
    >Const adResyncAutoIncrement = 1
    >Const adResyncConflicts = 2
    >Const adResyncInserts = 8
    >Const adResyncNone = 0
    >Const adResyncUpdates = 4
    >
    >' ADODB.ResyncEnum
    >Const adResyncAllValues = 2
    >Const adResyncUnderlyingValues = 1
    >
    >' ADODB.EventReasonEnum
    >Const adRsnAddNew = 1
    >Const adRsnClose = 9
    >Const adRsnDelete = 2
    >Const adRsnFirstChange = 11
    >Const adRsnMove = 10
    >Const adRsnMoveFirst = 12
    >Const adRsnMoveLast = 15
    >Const adRsnMoveNext = 13
    >Const adRsnMovePrevious = 14
    >Const adRsnRequery = 7
    >Const adRsnResynch = 8
    >Const adRsnUndoAddNew = 5
    >Const adRsnUndoDelete = 6
    >Const adRsnUndoUpdate = 4
    >Const adRsnUpdate = 3
    >
    >' ADODB.SchemaEnum
    >Const adSchemaAsserts = 0
    >Const adSchemaCatalogs = 1
    >Const adSchemaCharacterSets = 2
    >Const adSchemaCheckConstraints = 5
    >Const adSchemaCollations = 3
    >Const adSchemaColumnPrivileges = 13
    >Const adSchemaColumns = 4
    >Const adSchemaColumnsDomainUsage = 11
    >Const adSchemaConstraintColumnUsage = 6
    >Const adSchemaConstraintTableUsage = 7
    >Const adSchemaCubes = 32
    >Const adSchemaDBInfoKeywords = 30
    >Const adSchemaDBInfoLiterals = 31
    >Const adSchemaDimensions = 33
    >Const adSchemaForeignKeys = 27
    >Const adSchemaHierarchies = 34
    >Const adSchemaIndexes = 12
    >Const adSchemaKeyColumnUsage = 8
    >Const adSchemaLevels = 35
    >Const adSchemaMeasures = 36
    >Const adSchemaMembers = 38
    >Const adSchemaPrimaryKeys = 28
    >Const adSchemaProcedureColumns = 29
    >Const adSchemaProcedureParameters = 26
    >Const adSchemaProcedures = 16
    >Const adSchemaProperties = 37
    >Const adSchemaProviderSpecific = -1
    >Const adSchemaProviderTypes = 22
    >Const adSchemaReferentialConstraints = 9
    >Const adSchemaSchemata = 17
    >Const adSchemaSQLLanguages = 18
    >Const adSchemaStatistics = 19
    >Const adSchemaTableConstraints = 10
    >Const adSchemaTablePrivileges = 14
    >Const adSchemaTables = 20
    >Const adSchemaTranslations = 21
    >Const adSchemaTrustees = 39
    >Const adSchemaUsagePrivileges = 15
    >Const adSchemaViewColumnUsage = 24
    >Const adSchemaViews = 23
    >Const adSchemaViewTableUsage = 25
    >
    >' ADODB.SearchDirectionEnum
    >Const adSearchBackward = -1
    >Const adSearchForward = 1
    >
    >' ADODB.SeekEnum
    >Const adSeekAfter = 8
    >Const adSeekAfterEQ = 4
    >Const adSeekBefore = 32
    >Const adSeekBeforeEQ = 16
    >Const adSeekFirstEQ = 1
    >Const adSeekLastEQ = 2
    >
    >' ADODB.ObjectStateEnum
    >Const adStateClosed = 0
    >Const adStateConnecting = 2
    >Const adStateExecuting = 4
    >Const adStateFetching = 8
    >Const adStateOpen = 1
    >
    >' ADODB.EventStatusEnum
    >Const adStatusCancel = 4
    >Const adStatusCantDeny = 3
    >Const adStatusErrorsOccurred = 2
    >Const adStatusOK = 1
    >Const adStatusUnwantedEvent = 5
    >
    >' ADODB.XactAttributeEnum
    >Const adXactAbortRetaining = 262144
    >Const adXactCommitRetaining = 131072
    >
    >' ADODB.IsolationLevelEnum
    >Const adXactBrowse = 256
    >Const adXactChaos = 16
    >Const adXactCursorStability = 4096
    >Const adXactIsolated = 1048576
    >Const adXactReadCommitted = 4096
    >Const adXactReadUncommitted = 256
    >Const adXactRepeatableRead = 65536
    >Const adXactSerializable = 1048576
    >Const adXactUnspecified = -1
    >%>
    >
    ><%
    >Set orderFObj = Server.CreateObject("scripting.dictionary")
    >orderFObj.Add "number1", 100000.01
    >orderFObj.Add "number2", 1000000.01
    >
    >Call listDatadic(orderFObj)
    >xml = Dic2XML(orderFObj)
    >
    >response.Write(server.HTMLEncode(xml))
    >
    >Set orderFObj = nothing
    >%>
    >
    >
    >
    ><%
    >Function Dic2XML(orderFObj)
    >Dim rsx
    >Set Stream = Server.CreateObject("adodb.stream")
    >Set rsx = Server.CreateObject("adodb.recordset")
    >
    > With rsx
    > .Fields.Append "key", adVarChar, 80, adFldMayBeNull
    > .Fields.Append "value", adVarChar, 80, adFldMayBeNull
    > End With
    >
    >rsx.Open
    >
    >
    >If orderFObj.count > 0 then
    >For each key in orderFObj
    > rsx.AddNew
    > rsx("key") = key
    > rsx("value") = orderFObj(key)
    > rsx.Update
    >Next
    >end if
    >
    >rsx.Save stream, adPersistXML
    >Dic2XML = Stream.ReadText
    >
    >Set dataDic = nothing
    >Set rsx = nothing
    >Set Stream = nothing
    >
    >End Function
    >%>
    >
    ><%Function listDatadic(dic)%>
    ><%for each item in dic%>
    >key-><%=item%> value-><%=dic(item)%><BR>
    ><%next%>
    ><%End Function%>
    ftq@., Nov 18, 2005
    #3
  4. katrinaVictim@.

    functoid@. Guest

    Search on "functoid" in any archive service. FUNCTOID? Like the
    Windows 95 "ConnectOID"... LOL...

    Search on "Functoid"...

    LOL.
    functoid@., Nov 27, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Geisenhoff

    Bug in double precision computing?

    Daniel Geisenhoff, Jul 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    326
    Shan Plourde
    Jul 29, 2004
  2. Sydex
    Replies:
    12
    Views:
    6,453
    Victor Bazarov
    Feb 17, 2005
  3. inhahe
    Replies:
    3
    Views:
    2,323
    Diez B. Roggisch
    Jan 28, 2005
  4. Replies:
    1
    Views:
    831
  5. Replies:
    4
    Views:
    161
Loading...

Share This Page