-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_login.aspx.cs
54 lines (49 loc) · 1.61 KB
/
admin_login.aspx.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
49
50
51
52
53
54
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.OleDb;
namespace School_Management_System
{
public partial class admin_login : System.Web.UI.Page
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\School.mdb;");
OleDbDataAdapter da = new OleDbDataAdapter();
DataSet ds = new DataSet();
string pos = "admin";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void login_btn_Click(object sender, EventArgs e)
{
da.SelectCommand = new OleDbCommand("select pass from logintable where userid='" + userid_txtbx.Text + "' AND jposition='" + pos + "'", con);
ds.Clear();
da.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
sts_lbl.ForeColor = System.Drawing.Color.Red;
sts_lbl.Visible = true;
sts_lbl.Text = "Please Check Your Admin ID";
}
else
{
if ((ds.Tables[0].Rows[0][0].ToString()) == pass_txtbx.Text)
{
Response.Redirect("AddUser.aspx");
}
else
{
sts_lbl.Visible = true;
sts_lbl.Text = "Please Check Your Password";
}
}
}
protected void home_btn_Click(object sender, EventArgs e)
{
Response.Redirect("home.aspx");
}
}
}