Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rivate Sub ButtonSubmit_Click(sender As Object, e As EventArgs) Handles ButtonSubmit.Click
- Dim sqlcon As New SqlConnection With {.ConnectionString = "Server=essql1.walton.uark.edu;Database=PROJF1703;User Id=PROJF1703; Password=NV43wg$;"}
- Dim sqlcmd As SqlCommand
- Dim query As String
- Dim UserName As String
- Dim SQLPassword As String
- Dim GivenPassword As String
- query = "SELECT [UserName], [UserPassword] FROM Authenticate WHERE (UserName='" + TBUsername.Text + "')AND (UserPassword='" + TBPassword.Text + "');"
- 'query = "Select UserPassword FROM Authenticate WHERE UserName = '@accountName';"
- '"INSERT INTO questions (question) VALUES (@question);"
- Try
- sqlcon.Open()
- sqlcmd = New SqlCommand(query, sqlcon)
- Dim accountName As String = TBUsername.Text
- 'sqlcmd.Parameters.AddWithValue("@accountName", accountName)
- sqlcmd.ExecuteNonQuery()
- Dim reader As SqlDataReader = sqlcmd.ExecuteReader()
- If reader.HasRows Then
- While reader.Read()
- SQLPassword = reader("UserPassword").ToString()
- UserName = reader("UserName").ToString()
- GivenPassword = TBPassword.Text
- If SQLPassword = GivenPassword And UserName = TBUsername.Text Then
- Queries.Show()
- Else
- Form1.Show()
- End If
- End While
- End If
- Me.Close()
- Catch ex As Exception
- MsgBox(ex.Message)
- Throw ex
- Finally
- If sqlcon.State = ConnectionState.Open Then
- sqlcon.Close()
- End If
- End Try
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement