I want to save multiple list box value into a single field of a table using linq to entity. this is my code. any suggestion?
protected void Button5_Click(object sender, EventArgs e)
{
for(var i = 0; i < lb2.Items.Count; i++)
{
var e1 = new employee() { emp_skill = lb2.Items[i].Text };
je.employee.AddObject(e1);
}
je.SaveChanges();
}
Pravesh Singh
16-Dec-2013I assume your data is collection of string and you want to save it as single string. The following code make those collection of string become single string separated by semicolon, then you can save it as single row single column data:
And when you want to get it back as collection of string simply use Split() extension method :