I want to insert checked value in database with comma like(apple,banana,orange).
<p style="font-size: x-large; font-weight: bolder">
Skills</p>
<div class="dropdown">
<button class="dropbtn">
--Skills--</button>
<div class="dropdown-content">
<a href="#">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" />Asp.Net C#</a>
<a href="#">
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="true" />Python</a>
<a href="#">
<asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="true" />Android</a>
<a href="#">
<asp:CheckBox ID="CheckBox4" runat="server" AutoPostBack="true" />Php</a> <a href="#">
<asp:CheckBox ID="CheckBox5" runat="server" AutoPostBack="true" />Java</a>
<a href="#">
<asp:CheckBox ID="CheckBox11" runat="server" AutoPostBack="true" />HTML</a>
<a href="#">
<asp:CheckBox ID="CheckBox6" runat="server" AutoPostBack="true" />Accounting</a>
<a href="#">
<asp:CheckBox ID="CheckBox7" runat="server" AutoPostBack="true" />Account Management</a>
<a href="#">
<asp:CheckBox ID="CheckBox8" runat="server" AutoPostBack="true" />Machine Learning
(ML)</a> <a href="#">
<asp:CheckBox ID="CheckBox9" runat="server" AutoPostBack="true" />Graphic Design</a>
<a href="#">
<asp:CheckBox ID="CheckBox10" runat="server" AutoPostBack="true" />Travel and Tourism</a>
<a href="#">
<asp:CheckBox ID="CheckBox12" runat="server" AutoPostBack="true" />Human Resource
(HR)</a> <a href="#">
<asp:CheckBox ID="CheckBox13" runat="server" AutoPostBack="true" />Software Development</a>
<a href="#">
<asp:CheckBox ID="CheckBox14" runat="server" AutoPostBack="true" />Auditing</a>
</div>
</div>
int i = 0;
string message = "";
try
{
string constr = ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ConnectionString;
using (SqlConnection conn = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO Post_job_details (Job_title,Company_name,Salary,Skills,Qualification,Details,Experience,email,City,Location,Age,Last_Apply_date,State) VALUES (@Job_title,@Company_name,@Salary,@Skills,@Qualification,@Details,@Experience,@email,@city,@Location,@Age,@Last_Apply_date,@State)", conn))
{
cmd.Parameters.AddWithValue("@Job_title", title.Text.ToString());
cmd.Parameters.AddWithValue("@Company_name", cname.Text.ToString());
cmd.Parameters.AddWithValue("@Salary", salary.Text.ToString());
cmd.Parameters.AddWithValue("@Skills", message.ToString());
cmd.Parameters.AddWithValue("@Qualification", Degree.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@Details", details.Text.ToString());
cmd.Parameters.AddWithValue("@Experience", exp.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@email", email.Text.ToString());
cmd.Parameters.AddWithValue("@city", city.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@State", state.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Location", Location.Text.ToString());
cmd.Parameters.AddWithValue("@Age", Age.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@Last_Apply_date", Apply.Text.ToString());
conn.Open();
i = cmd.ExecuteNonQuery();
conn.Close();
}
}
if (i > 0)
{
lab.Text = "Job Posted successfully.";
lab.Visible = true;
}
else
{
lab.Text = "Error while Posting..!!";
}
}