IS 341: Project 12 Solution
0 HW points, 30 PDP points


Homework

There was no homework portion to this assignment.

Personal Database Project

For this solution, I modified the login code from project #11 as follows. Note that I've used a dataset here - perhaps a datareader would be more appropriate given that we're only reading the password.

Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
    Feedback.Text = ""
    Dim DataSet1 As New DataSet
    Dim aRow As DataRow
    Me.SqlSelectCommand1.CommandText = "SELECT password FROM Customers WHERE loginid='" + LoginID.Text + "'"
    Me.SqlDataAdapter1.Fill(DataSet1, "dsPassword")
    If DataSet1.Tables("dsPassword").Rows.Count = 1 Then
        aRow = DataSet1.Tables("dsPassword").Rows.Item(0)
        If (System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text, "md5") = aRow("password")) Then
            Session("loginID") = LoginID.Text
            System.Web.Security.FormsAuthentication.RedirectFromLoginPage(LoginID.Text, False)
        Else
            Feedback.Text = "Invalid password..."
        End If
    Else
        Feedback.Text = "Unknown user..."
    End If
End Sub

The code to create the HTML table filled with data from the database is covered in detail in the lecture notes.


Last modified: Fri Dec 12 10:00:38 Eastern Standard Time 2003
© 2003 Calvin College