Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get an xml with diffgram and schema from a datagrid
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00845136
Message ID:
00845456
Views:
18
Hi Pablo,

When working with DiffGrams, you need to do a work-around to get the schema inline with the data. Here is some sample code that uses a DataSet and pulls out the changed data and creates an xml stream that conatins the changed data in DiffGram format and contains the schema. This sample was done in VB.NET for a conference I spoke at but you can get the concept of how to do it in C#.
   ' Call the XML web service to update data to the backend 
    Public Function SendData(ByVal ds As DataSet) As Boolean
        ' Create a new dataset that only contains
        ' the inserted/modified records
        Dim dsChanges As DataSet
        dsChanges = ds.GetChanges()

        ' Create an instance of the XML web service object
        Dim oPatient As New MedAppWS()

        ' Create an XML Diffgram with inline schema to be
        ' passed to the XML web service
        Dim serializer As New XmlSerializer(GetType(DataSet))
        Dim ms As MemoryStream = New MemoryStream()
        Dim writer = New XmlTextWriter(ms, New UTF8Encoding())
        serializer.Serialize(writer, dsChanges)
        ms.Position = 0
        Dim sr As New StreamReader(ms)

        ' Call the XML web service and return if update
        ' was successful or not
        Return oPatient.UpdateData(sr.ReadToEnd())
    End Function
>Hello!
>
>I need to get a diffgram xml with schema from a datagrid, but I can't found the way ... help me please!
>
>Thanx in advance.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform