Hi,
Lemme guess you are iterating parameters inside foreach,
try the below code and check
foreach (ListItem li in lstPrimaryImpactedArea.Items)
{
if (li.Selected == true)
{
n += lstPrimaryImpactedArea.SelectedItem.Value;
}
}
cmd.Parameters.AddWithValue("@primaryimpactedarea", n);
Updated as per your comments:
You can use SelectedItems to get desired selected items from listbox like this
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected)
{
n += ListBox1.Items[i].Value;
}
}
Hope this helps you a bit.
Regards,
RK