using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;//1
using System.Data.SqlClient;//2


public partial class drlogin : System.Web.UI.Page
{
    SqlDataAdapter adp = new SqlDataAdapter("select * from drregnew", @"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\website\doctor\App_Data\drreg.mdf;Integrated Security=True;User Instance=True");//3
    DataTable dt = new DataTable();//4
    protected void Page_Load(object sender, EventArgs e)
    {
        adp.Fill(dt);//5
        SqlCommandBuilder str = new SqlCommandBuilder(adp);//6
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("home.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("drnewreg.aspx");
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        try
        {
            DataRow[] dr = dt.Select("DOCTOR_ID='" + txtDrid.Text + "'");
            if (dr[0]["PASSWORD"].ToString() == txtDrpass.Text)
            {
                Session["DOCTOR ID"] = dr[0]["DOCTOR_ID"].ToString();
                Response.Redirect("patientlist.aspx");
            }
            else
            {
                lblError.Text = "Please enter valid password.....";
            }
        }
        catch
        {
            lblError.Text = "Register First...";
        }
    }
}