Homework
For this solution, I modified the login code from project #10 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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SQLCommand As New System.Data.SqlClient.SqlCommand SQLCommand.Connection = Me.SqlConnection1 SQLCommand.CommandText = "SELECT password FROM Users WHERE loginID = '" + txtLogin.Text + "'" Dim dataReader As System.Data.SqlClient.SqlDataReader Me.SqlConnection1.Open() dataReader = SQLCommand.ExecuteReader() dataReader.Read() If dataReader.HasRows() Then If Not dataReader.IsDBNull(0) Then If txtPassword.Text = dataReader.GetString(0) Then lblOutput.Text = "You're in..." Else lblOutput.Text = "login failed..." End If Else lblOutput.Text = "login failed..." End If Else lblOutput.Text = "login failed..." End If End Sub
Personal Database Project
As usual, I looked over what I could find on your server and accepted most anything that worked properly.
Back to the top