public void button1Clicked(object sender, EventArgs e) { string output = ""; int s = Convert.ToInt32(Session["ID"]); string type = TypeDropdown.Text; string category = CategoryDropdown.Text; string subcategory = SubcategoryDropdown.Text; string link = linkTB.Text; int requestId = Int32.Parse(RequestDropdown.SelectedValue); if (link.Equals("")) { output = "You have to enter a link"; L1.Text = output; return; } try { string connetionString; SqlConnection cnn; connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString; cnn = new SqlConnection(connetionString); cnn.Open(); SqlCommand command; SqlDataReader dataReader; String sql; sql = "Upload_New_Content"; command = new SqlCommand(sql, cnn); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@subcategory_name", subcategory)); command.Parameters.Add(new SqlParameter("@category_id", category)); command.Parameters.Add(new SqlParameter("@contributor_id", s)); command.Parameters.Add(new SqlParameter("@link", link)); command.Parameters.Add(new SqlParameter("@new_request_id", requestId)); command.Parameters.Add(new SqlParameter("@type_id", type)); dataReader = command.ExecuteReader(); dataReader.Close(); cnn.Close(); output = "Content Uploaded Successfully"; RequestDropdown.DataBind(); } catch { output = "Make sure to complete all fields"; } L1.Text = output; }
public void button1Clicked(object sender, EventArgs e) { try { string connetionString; SqlConnection cnn; connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString; cnn = new SqlConnection(connetionString); cnn.Open(); SqlCommand cmd = new SqlCommand("Assign_Contributor_Request", cnn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@contributor_id", ContributerDropdown.SelectedValue)); cmd.Parameters.Add(new SqlParameter("@new_request_id", RequestDropdown.SelectedValue)); cmd.ExecuteReader(); L1.Text = "Contributer Assigned Successfully"; RequestDropdown.DataBind(); ContributerDropdown.DataBind(); } catch { L1.Text = "Something went wrong, make sure you selected values in all fields"; } }