-
Notifications
You must be signed in to change notification settings - Fork 0
/
Admin_RemoveFaculty.ascx.cs
48 lines (45 loc) · 1.68 KB
/
Admin_RemoveFaculty.ascx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Admin_RemoveFaculty : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
dbconnection db1 = new dbconnection();
SqlCommand cmd1 = new SqlCommand();
cmd1.CommandText = "select * from tblFaculty";
DataList1.DataSource = db1.executeread(cmd1);
DataList1.DataBind();
if (Request.QueryString["id"] != null)
{
Panel1.Visible = true;
string cid = Request.QueryString["id"];
dbconnection db2 = new dbconnection();
SqlCommand cmd2 = new SqlCommand();
cmd2.CommandText = "select * from tblFaculty where TeacherID=@cid";
cmd2.Parameters.AddWithValue("@cid", cid);
SqlDataReader dr = db2.executeread(cmd2);
dr.Read();
Label11.Text = dr.GetString(0);
Label12.Text = dr.GetString(1);
Label13.Text = dr.GetString(2);
Label14.Text = dr.GetString(3);
Label16.Text = dr.GetString(4);
Label6.Text = dr.GetString(5);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
dbconnection db3 = new dbconnection();
SqlCommand cmd3 = new SqlCommand();
cmd3.CommandText = "delete from tblFaculty where TeacherID=@cc";
cmd3.Parameters.AddWithValue("@cc", Label11.Text);
db3.execute(cmd3);
Response.Redirect("Admin_RemoveFaculty.aspx");
}
}