public class DB { SqlConnection conn; SqlCommand com; DataTable TB = new DataTable(); private void Initialize(CommandType CT, string DBCall) { conn = new SqlConnection(); com = new SqlCommand(); conn.ConnectionString = ConfigurationManager.ConnectionStrings[1].ToString(); com.CommandType = CT; com.Connection = conn; com.CommandText = DBCall; conn.Open(); } public DataTable RunQuery(string SelectQ) { Initialize(CommandType.Text, SelectQ); TB = new DataTable(); TB.Load(com.ExecuteReader()); return TB; }
public bool Login(string UserN, string Pass) { string query = string.Format("Select * From [RegMember] Where UserName='{0}' and Password='{1}' ", UserN, Pass); if (db.RunQuery(query).Rows.Count == 1) return true; else return false; } protected void Btnlogin_Click(object sender, EventArgs e) { RegMember member = new RegMember(); if (member.Login(TxtName.Text, TxtPasss.Text)) LblMessage.Text = "User ,Ok"; else LblMessage.Text = "username or pass incorrect"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)