title: The variable name '@days' has already been declared. Variable names must be unique within a query batch or stored procedure
body: <p>i want to store multiple selected values of checkboxlist in sql server. when i select one value it goes into database but when selected multiple it gives above error.  </p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
      {
   SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["IvrContext"].ConnectionString);
          conn.Open();
          SqlCommand com1 = new SqlCommand("INSERT into Ivrdatas (days) values (@days)", conn);
          string empty = "";
          foreach (ListItem lst in CheckBoxList1.Items)
          {
              if (lst.Selected == true)
              {
                  empty = empty + " " + lst.Value;
                  com1.Parameters.AddWithValue("@days", empty);
                       com1.ExecuteNonQuery();
              }
          } 
          conn.Close();
  
  
  
      }
  </code></pre>
  
  <p>here is my html.</p>
  
  <pre><code>   &lt;asp:CheckBoxList ID="CheckBoxList1" runat="server" style="margin-left: 299px" AutoPostBack="True"&gt;
          &lt;asp:ListItem&gt;Monday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Tuesday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Wednesday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Thursday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Friday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Saturday&lt;/asp:ListItem&gt;
          &lt;asp:ListItem&gt;Sunday&lt;/asp:ListItem&gt;
  
      &lt;/asp:CheckBoxList&gt;
  </code></pre>