using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace book
{
public partial class login : Form
{
SqlConnection conn;
SqlCommand cmd;
SqlDataReader reader;
public login()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)//MY login button
{
string constr = @"Data Source=PRAVEEN\SQLEXPRESS;Initial Catalog=travelbooking;Integrated Security=True";
conn = new SqlConnection(constr);
conn.Open();
cmd = new SqlCommand("select *from travelregi where name='" + username + "' and password='" + pwd + "'", conn);
reader = cmd.ExecuteReader();
if(reader.HasRows)
{
{
MessageBox.Show("sucessful");
}
reader.Close();
conn.Close();
}
}
I am trying to check if username and password match from database. But when i hit login ion form nothing hapens :(