Sub btnLogin_Click(sender As Object, e As EventArgs)
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";Jet OLEDB:Database Password=;"
objConn.ConnectionString = strConnString
objConn.Open()
Dim dtAdapter As OleDbDataAdapter
Dim dt As New DataTable
strSQL = "SELECT * FROM member WHERE Username = '"& Me.txtUsername.Text &"' AND [Password] = '"& Me.txtPassword.Text &"' "
dtAdapter = New OleDbDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
IF dt.Rows(0)("Status") = "admin" Then
Response.Redirect("admin.aspx")
Else
Response.Redirect("user.aspx")
End IF
Else
Me.pnlLogin.Visible = False
Me.lblStatus.Visible = True
Me.lblStatus.Text = "Username/Password is wrong."
End IF
objConn.Close()
objConn = Nothing
End Sub