Advertisement
In database I created a column with name EmpDesignation nvarchar(max).
I created a stored procedure
Create procedure [dbo].[SP_InsertEmpinfo]
(
@EmpDesignation nvarchar(MAX)
)
As Begin
Insert into Employee (EmpDesignation) values (@EmpDesignation)
end
Software Engineer
Sr. Software Eng
Software Architech
Design Engineer
Team Lead
Assistant Proj Manager
Proj Manager
Service Head
protected void btninsert_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("SP_InsertEmpinfo", con);
cmd.CommandType = CommandType.StoredProcedure;
strdes = "";
for (int i = 0; i <= chkdes.Items.Count - 1; i++)
{
if (chkdes.Items[i].Selected)
{
if (strdes == "")
{
strdes = chkdes.Items[i].Text;
}
else
{
strdes += "," + chkdes.Items[i].Text;
}
}
}
cmd.Parameters.Add("@EmpDesignation", SqlDbType.NVarChar).Value = strdes ;
con.Open();
cmd.ExecuteNonQuery();
clear();
con.Close();
}
public void clear()
{
chkdes.SelectedIndex = -1;
}
}
}

0 comments:
Post a Comment