using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["PassConnectionString"].ConnectionString);
con.Open();
if (true)
{
SqlCommand level = new SqlCommand("select accessLevel, Password from TableSecurity where EmailAddress = @Email AND Password = @password", con);
level.Parameters.Add(new SqlParameter("Email", TextBoxEA.Text));
level.Parameters.Add(new SqlParameter("password", TextBoxPW.Text));
SqlDataReader reader = level.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(reader);
foreach (DataRow dr1 in dt1.Rows)
{
int returnedLevel = Convert.ToInt32(dr1[0].ToString());
if (returnedLevel == 1)
{
Response.Redirect("~/Default2.aspx");
}
else if (returnedLevel == 2)
{
Response.Redirect("~/Default2.aspx");
}
}
}
con.Close();
}
}