Last post Mar 09, 2015 06:46 PM by prichardsonDev
Mar 09, 2015 02:30 PM|prichardsonDev|LINK
A user enters/selects data for an order in Orders Table. From a single record in Orders Table I need to calculate a Bill Of Materials
which I would also like to store in the/a database - this data is represented by a table. Could some please tell me the
best way to design/link a record in my Orders Table to a entire Table of data. Can I store List<T> in a database? ty
Mar 09, 2015 04:25 PM|csharpgreg|LINK
Hello prichardsonDev! Thanks for your post!
If you don't need to de-serialize the Bill of Materials data later on I would store the data as a string in the database as HTML. If you do need to de-serialize the "Bill of Materials" data later on you could store it in the database as xml.
For both options - HTML or xml just store the whole string in a BLOB field.
var sBom = "<table><tr>";
foreach (var item in lstItems)
// Add all items
sBom += "<td>" + item.value + "</td>";
// Add </tr> after all items
sBom += "</tr>";
// Add </table>
sBom += "</table>";
// To do: Insert sBom into BLOB field
Mar 09, 2015 06:46 PM|prichardsonDev|LINK
Thanks... Seems XML will be the way to go. I've got some pretty complex calculations for the BOM and many of them. Want to be able to always
tie back the calculations to the original order data for debugging and future predictions on what a user is going to enter for order data. Thanks for the help.