Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a RadioButtonList on that their is two option CD and DVD. In My Category table their is two Column CatId and CategoryName, CD and DVD is their, in CategoryName with its Id.Now while selecting one from the RadioButtonList, I want to save its Id in another table with some other value for that, what should I do please provide any suggestion better if I will get code. Thanks

I am using VS2005 and SQL 2005 its in webform


My Code is like this


ConnectionStr();
con.Open();

SqlCommand cmd=new SqlCommand("Insert into CDcutDetails(Catid,PId,Date,DepName,Available_Qty,Alloted_To,CDCutBy,Remarks) Values('" + RadioBtnList_CD_DVD.SelectedItem+ "','" + ddlProductName.SelectedValue + "','" + tboxDate.Text.Trim() + "','" + ddlDepName.SelectedValue + "','" + tboxAllotQty.Text.Trim() + "','" + ddlAllotedTo.SelectedValue + "','" + ddlCD_CutBy.SelectedIndex + "','" + tboxRemark.Text.Trim() + "')", con);

cmd.ExecuteNonQuery();
LblMsg.Text = "Records Saved Successfully";
con.Close();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900