Serialize dynamic record to xml in vb.net RRS feed

  • Question

  • User-1936369461 posted


    I need a way to serialize dynamic record to xml in vb.net.
    If i do a normal:
    Dim rs = db.Query("select * from table")
    I then want to convet the result into xml.
    It would be nice to have a function that can take all sorts of objects as input, like JsonConvert.SerializeObject(rs) in Newtonsoft.Json or json.encode

    Found a possible solution here:
    But i have not been able to convert it to vb.net

    I have tried XmlSerializer(dataToSerialize.[GetType]() whith no luck.

    Anyone have any solution?


    Wednesday, May 4, 2016 7:16 AM


  • User-1636183269 posted

    Please do:

    Dim rs = db.Query("select Col1,Col2,Col3 from table FOR XML RAW;")

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2016 7:20 AM