Is there an easy way to store an array into a single column in a SQL Server CE database?
asp.net-webpages, c#, sql-server-ce, webmatrix
Solution
Convert your string array into single String like given below:
var a = String.Join(",",arrays);
//or aim is to provide a unique separator,
//i.e which won't be the part of string values itself.
var a= String.Join("~~",arrays);
and fetch it back like this:
var arr = a.Split(',');
//or split via multiple character
var arr = a.Split(new string[] { "~~" }, StringSplitOptions.None);
Problem
I have reviewed possible answers here (for PHP, I think): http://www.lateralcode.com/store-array-database/ but I am unable to find a C#.net version of serialize/deserialize. Would this be done the same as the way shown in my link, above, or is there a completely different approach I should be using, given the environment? I just don't want to have a bunch of different columns for each of the 12 values in each of my 9 different arrays, so if there is another approach to achieve this (converting to byte[], etc.) I am more than willing to hear it. If it helps any, the arrays will be simple string[] arrays.