protected void btn_submit_Click(object sender, EventArgs e) { string dt2 = Convert.ToString(dt); string dt4 = dt2.Substring(0, 10); x.conopen(); qry = "select * from paper where pname='" + txtpname.Text + "'"; dtt = x.ser(qry); if (dtt.Rows.Count == 0) { x.conclose(); x.conopen(); qry = "insert into paper values('" + txtpname.Text + "','" + dt4 + "')"; x.iud(qry); x.conclose(); Panel1.Visible = true; x.qry = "SELECT que as Question,ans1 as Ans1, ans2 as Ans2, ans3 as Ans3, ans4 as Ans4,type as Type FROM question WHERE sid =" + subject.SelectedValue + " AND cid =" + chapter.SelectedValue; x.ds = x.fillgrid(x.qry); GridView1.DataSource = x.ds.Tables[0]; GridView1.DataBind(); } else { lbl_sub.Text = "This Paper Name Is Already exist"; Response.AddHeader("refresh", "2;url=generatepaper.aspx"); } }
protected void btn_submit_Click(object sender, EventArgs e) { Panel1.Visible = true; x.conopen(); qry = "select ques as Question,ans1 as Ans1, ans2 as Ans2, ans3 as Ans3, ans4 as Ans45 from questionpaper where pid='" + paper.SelectedItem.Value + "'"; x.ds = x.fillgrid(qry); GridView1.DataSource = x.ds.Tables[0]; GridView1.DataBind(); x.conclose(); }