<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<%@ Page Language="VB" %>
<script runat="server">
Dim objConn As New OleDbConnection
Dim objCmd As New OleDbCommand
Dim strConnString, strSQL As String
Sub btnLogin_Click(ByVal sender As Object, ByVal e As EventArgs)
strConnString = "Provider=SQLOLEDB;Data Source=MY20\SQLEXPRESS;Initial Catalog=Test01;UserId=sa;Password=;"
objConn.ConnectionString = strConnString
objConn.Open()
Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM MemberDetail WHERE EMID = '" & Me.txtUsername.Text & "' AND [EMPass] = '" & Me.txtPassword.Text & "' "
objCmd = New OleDbCommand(strSQL, objConn)
intNumRows = objCmd.ExecuteScalar()
If intNumRows > 0 Then
Session("strUser") = Me.txtUsername.Text
Response.Redirect("Page1.aspx")
Else
Me.pnlLogin.Visible = False
Me.lblStatus.Visible = True
Me.lblStatus.Text = "Username/Password is wrong."
End If
objConn.Close()
objConn = Nothing
End Sub