protected void Button1_Click(object sender, EventArgs e) { try { string str; if (ddl_shift.SelectedValue == "Morning") { str = "8:00 AM to 9:00 AM," + "Teacher:" + ddl_teacher.SelectedValue + ",Subject:" + ddl_subject.SelectedValue; } con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["atharva-classesConnectionString"].ConnectionString; con.Open(); cmd.Connection = con; cmd.CommandText = "ins_timetable"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@shift", ddl_shift.SelectedValue); cmd.Parameters.AddWithValue("@class", ddl_class.SelectedValue); cmd.Parameters.AddWithValue("@lecture", ddl_lecture.SelectedValue); cmd.Parameters.AddWithValue("@lectype",ddl_lecture.SelectedValue); cmd.Parameters.AddWithValue("@teacher", ddl_teacher.SelectedValue); cmd.Parameters.AddWithValue("@subject", ddl_subject.SelectedValue); cmd.Parameters.AddWithValue("@day", ddl_day.SelectedValue); cmd.ExecuteNonQuery(); ddl_class.SelectedValue = "0"; ddl_day.SelectedValue = "0"; ddl_lecture.SelectedValue = "0"; ddl_shift.SelectedValue = "0"; ddl_subject.SelectedValue = "0"; ddl_teacher.SelectedValue = "0"; } catch(Exception ex) { lbl_error.Visible = true; lbl_error.Text = ex.ToString(); } finally { con.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)