-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdmin.aspx.cs
More file actions
45 lines (41 loc) · 1.4 KB
/
Copy pathAdmin.aspx.cs
File metadata and controls
45 lines (41 loc) · 1.4 KB
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
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 : System.Web.UI.Page
{
SqlConnection cn;
protected void Page_Load(object sender, EventArgs e)
{
cn = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Reaper\Documents\DB.mdf;Integrated Security=True;Connect Timeout=30");
Label1.Text = Session["email"].ToString();
Label2.Text = Session["password"].ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cm = new SqlCommand("delete from udata where id ='" + t.Text + "'", cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
Response.Redirect("Admin.aspx");
}
//protected void Button3_Click(object sender, EventArgs e)
//{
// SqlCommand cm = new SqlCommand("insert into udata values('" + t.Text + "','" + t1.Text + "')", cn);
// cn.Open();
// cm.ExecuteNonQuery();
// cn.Close();
//}
protected void Button2_Click(object sender, EventArgs e)
{
SqlCommand cm = new SqlCommand("update udata set password ='"+t1.Text+"'where id='"+t.Text+"' ",cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
Response.Redirect("Admin.aspx");
}
}