Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric problem with received XML data
Message
From
17/02/2006 16:02:16
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097069
Message ID:
01097192
Views:
14
How are the datatypes of your .NET dataset defined? Are you getting the data initially from somewhere else? Are you using an .xsd for the schema? In other words, how is the datatype being defined initially as decimal? Seems to me you want an integer. If you used an .xsd schema for your DataSet, you could simply change that column to int in the .xsd.

~~Bonnie



>Aleksey,
>
>Thanks for the info. The type definition is being generated from .NET Dataset using:
>
>StringWriter sw = new StringWriter();
>dataSet.WriteXml(sw, XmlWriteMode.WriteSchema);
>
>I will have to patch the issue within the VFP web service.
>
>Thanks,
>Mike
>
>>This can cause the problem. Either include totalDigits and fractionDigits facets into XML type definition for tempno or manually adjust VFP data type for corresponding XMLField object.
>>
>>>The index expression is simply on the field which is a numeric type N(10,0). The cursor created by the xmlAdapter shows numeric type N(20,19) which seems a bit odd. The value in the cursor appears as 29131.00000000000000
>>>
>>>>Hi Michael,
>>>>
>>>>Is the type of the index expression the same as the type of the header.tempno field?
>>>>
>>>>Aleksey.
>>>>
>>>>
>>>>>I’m sending a dataset from .NET 2.0 to a VFP web service. When I receive the data into VFP there appears to be something strange happening with numeric fields.
>>>>>
>>>>>You can save numeric data and perform arithmetic operations with no problem. If I take a numeric value and attempt a seek on a table it will not find the matching record. If I perform any type of arithmetic op on the value prior to the seek it will find the record.
>>>>>
>>>>>VFP Test code:
>>>>>PROCEDURE UpdateTemplate(lcXMLDataSet as String) as String
>>>>>   LOCAL loXMLAdapter AS XMLAdapter
>>>>>   loXMLAdapter = CREATEOBJECT("XMLAdapter")
>>>>>   loXMLAdapter.LoadXML(lcXMLDataSet)
>>>>>   loXMLAdapter.Tables(1).ToCursor(.f.,"header")
>>>>>   loXMLAdapter.Tables(2).ToCursor(.f.,"detail")
>>>>>   loXMLAdapter.Tables(3).ToCursor(.f.,"smartcode")
>>>>>   USE (datapath + "gphmast.dbf") SHARED IN 0
>>>>>   USE (datapath + "gphdtail.dbf") SHARED IN 0
>>>>>   USE (datapath + "gphesc.dbf") SHARED IN 0
>>>>>   SELECT header
>>>>>   m.tempno = tempno	&&Get PK value to search for
>>>>>   SELECT gphmast
>>>>>   SET ORDER TO tempno
>>>>>   IF SEEK(m.tempno)	&& --- Seek Fails!
>>>>>      rtnval = "Record Found!"
>>>>>   ELSE
>>>>>      rtnval = "Template " + str(m.tempno) + " Not found.
>>>>>   ENDIF
>>>>>   RETURN rtnval
>>>>>ENDPROC
>>>>>
>>>>>If I change the seek to: “SEEK (m.tempno+0)” it finds the matching record.
>>>>>Other commands that failed were:
>>>>>LOCATE FOR tempno = m.tempno
>>>>>SELECT * FROM gphmast where tempno = m.tempno
>>>>>
>>>>>If I locate the record and compare it will match
>>>>>SELECT (29131)
>>>>>Compairing Tempno = m.Tempno returns true
>>>>>
>>>>>When I save the received data into the datatable everything looks ok. It seems to be something with using the numeric value against a table index.
>>>>>
>>>>>The XML string received by the VFP web service has the value defined as:
>>>>>Schema:
>>>>>
<xs:element name="tempno">
>>>>> <xs:simpleType>
>>>>>  <xs:restriction base="xs:decimal" />
>>>>> </xs:simpleType>
>>>>></xs:element>
>>>>>Data:
>>>>>    <tempno>29131</tempno>
>>>>>
>>>>>
>>>>>When I run similar code from the command window (pulling the xml from a file) it finds the record.
>>>>>
>>>>>Can anybody shed some light on what is happening here?
>>>>>
>>>>>Thanks,
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform