Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataSet looses digits sepecified in Schema for Decimal t
Message
De
29/06/2004 21:17:58
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00918602
Message ID:
00918817
Vues:
6
Sylvain,

Well, I'm not sure exactly why the schema isn't getting properly read into the .NET dataset. You *do* have an inline schema in the XML coming from Fox, right?

If this .NET DataSet is of a known format, maybe it would be better to create an .xsd for your DataSet in .NET and use a Typed DataSet. Then, when you read it, you would use the XmlReadMode.InferSchema.

I haven't used anything other than just plain decimal in my .xsd schemas (even though they may be different on the database, I'm using SQL Server), so I'm not 100% sure if this would work correctly, but I don't see why not.

Sorry I couldn't offer more suggestions. =(

~~Bonnie


>Hi,
>
>I use the VFP XmlAdapater to create an XML DataSet that is sent to a .NET application through a webservice, on the other site I use a DataSet.ReadXML call to load the data into my dataset. Later I use a DataSet.WriteXML call to send back the data to VFP. Everything works fine except the decimals, both VFP and .NET messes with them!
>
>I did this to check for the differences between the XML files generated by both, and below the code I pasted all numeric fields from both the Vfp.xml and Dotnet.xml files
>
>
>'Writes to disk the XML received from VFP
>Dim oStream As New StreamWriter("vfp.xml")
>oStream.Write(cXML)
>oStream.Close()
>
>
>'Loads XML received from VFP in a new DataSet
>Dim oDS As New DataSet("VFPDataSet")
>Dim oXMLTR As New XmlTextReader(New StringReader(cXML))
>'oDS.ReadXmlSchema(oXMLTR)
>oDS.ReadXml(oXMLTR, XmlReadMode.ReadSchema)
>oDS.AcceptChanges()
>
>'Writes to Disk XML of the DataSet
>Dim oFileStream As New FileStream("dotnet.xml", _
>    FileMode.Create, FileAccess.Write)
>Dim oXMLTW As New XmlTextWriter _
>    (oFileStream, System.Text.Encoding.UTF8)
>oDS.WriteXml(oXMLTW, XmlWriteMode.WriteSchema)
>oXMLTW.Close()
>oFileStream.Close()
>
>In the Vfp.xml file, for all restriction base="sxd:decimal", both the Totaldigits and fractiondigits are present and corresponding to the backend databases, but in Dotnet.xml, for all decimal fields, the totalDigits and FractionDigits fields disappeared! So when I load back in VFP, all numeric fields ends up being N(20,19)...
>
>Can anybody help me ? Why is that and how can I fix that ?
>
>Thanks,
>Sylvain Bujold
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform