Start New Discussion within our Software Development Community
  Dim sqlconn As SqlConnection = New SqlConnection("data source=MCKAYLA\SQLEXPRESS;Initial Catalog=jhen_reg;Integrated Security=True")
        Dim sqlda As New SqlDataAdapter
        Dim sqlcmd As New SqlCommand
        Dim dt As New DataTable
        Dim sqlstr As String = "SELECT * FROM reg where Username=@Usernametextbox.text AND Password=@Passwordtextbox.text"
        With sqlcmd
            .CommandText = sqlstr
            .Connection = sqlconn
            .Parameters.AddWithValue("@Username", UsernameTextBox.Text)
            .Parameters.AddWithValue("@Password", PasswordTextBox.Text)
        End With
        sqlda.SelectCommand = sqlcmd
        sqlda.Fill(dt)

        If UsernameTextBox.Text = "" Or PasswordTextBox.Text = "" Then
            MsgBox("Please Check Username, Password and Log in level," & UsernameTextBox.Text, MsgBoxStyle.Exclamation, "jhen_reg Alert")
            UsernameTextBox.Text = ""
            UsernameTextBox.Text = ""
            UsernameTextBox.Focus()
        ElseIf dt.Rows.Count > 0 Then
            MsgBox("Log In Success!, " & UsernameTextBox.Text, MsgBoxStyle.Information, "jhen_reg Log In")
            Form1.Show()
            Me.Close()
        Else

            MsgBox("Please Check Username,Password and Log in level," & UsernameTextBox.Text, MsgBoxStyle.Exclamation, "jhen_reg Alert")
            UsernameTextBox.Text = ""
            UsernameTextBox.Text = ""
            UsernameTextBox.Focus()
        End If
This article has been dead for over six months. Start a new discussion instead.