Imports System.Data.Oledb Public Class login Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents cmdlogin As System.Web.UI.WebControls.Button Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents txtuname As System.Web.UI.WebControls.TextBox Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label3 As System.Web.UI.WebControls.Label Protected WithEvents txtpword As System.Web.UI.HtmlControls.HtmlInputText Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub Private Sub cmdlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdlogin.Click If txtuname.Text = "admin" And txtpword.Value = "admin" Then Server.Transfer("home.aspx") End If Dim con As New OleDbConnection, cmd As New OleDbCommand, Rs As OleDbDataReader con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" & MapPath("db") & "\db.mdb;" If con.State <> 0 Then con.Close() con.Open() cmd.CommandText = "Select * from Doctor where uname='" & txtuname.Text & "' and pword='" & txtpword.Value & "'" cmd.Connection = con Rs = cmd.ExecuteReader If Rs.Read Then Session("DoctorCode") = Rs.GetValue(0) Session("Doctorname") = Rs.GetValue(1) con.Close() Server.Transfer("dochome.aspx") Else Label3.Visible = True txtuname.Text = "" txtpword.Value = "" End If End Sub End Class