Is it possible to store multiple values in one cell in database?
Based on the picture below on column famcon
, only one value from a checkedlistbox can be inserted even if the user chose multiple values.
this is my query for this table:
foreach (DataRowView item in this.checkedListBox1.CheckedItems)
{
NpgsqlCommand cmd = new NpgsqlCommand("Insert into name (eid, name, famcon) SELECT @eid, @name, @famcon", conn);
cmd.Parameters.AddWithValue("@eid", textBox1.Text);
cmd.Parameters.AddWithValue("@name", textBox2.Text);
string[] value = item.Row[0].ToString().Split(',');
cmd.Parameters.AddWithValue("@famcon", value);
cmd.ExecuteNonQuery();
}