none
XML to Generic::List<customObject> to ADO's TVP RRS feed

  • Question

  • C++/CLI, latest version of VS and SQL Server Standard. I have a message coming in from a domain queue (MQ) as a binary array of UTF-8. This particular message contains a list that I need to perform a two-way mismatch test on for data that's already stored in a local database table.

    I plan to create a table from the list, then do a union on the two tables and looking for those rows without duplicates to identify mismatches. (Any row that exists in both tables, and they all should, will occur twice; the rest are mismatches.

    I get the XML in a char array, I've managed to figure out the XML parser using custom objects with the attributes marking element matching with the object fields. This object contains two fields, and as I said, I have a list of them.

    If I loop through each item and store them into a table, I can't use a temp table because as soon as the loop shoves data into the table, the table goes out of scope and is purged. So, I need to pass the whole list of objects into one stored procedure, which, aside from being new to me, sounds fine. I believe I have the details of that down, but I need to get the data from the Generic List<object> to a TVP.

    My questions: What's the best way I can do this? Can I deserialize directly into a DataTable? Can I pass the List<myObject> directly as a TVP? Can I add a method to myObject to allow it to pass directly as a TVP? Or do I need to loop through each list item and manually copy to the equivalent DataTable?

    Friday, June 14, 2013 9:08 PM

Answers

All replies