none
UserID and Password Validation; Please Help!!!

    Question

  • Please Help! I have a form with a txtLoginID, txtPassword, and a button named cmdLogin. My database name is called "Intake" and my table is "Login." I also have an "IntakeDataSet" that links to my Login table with an SQL connection. The area of the code that continues to generate errors are in the connection and select statements. Your help will be greatly appreciated.

    Private Sub cmdLogin_Click(sender As Object, e As EventArgs) Handles cmdLogin.Click

                Dim conn As New SqlClient.SqlConnection
                conn.ConnectionString = ";Initial Catalog=Intake;user_login=; user_password="

                Try

                    'conn.Open()

                    'MsgBox("Login Successfull")

                    Dim sql As String = "SELECT user_login,user_password FROM login WHERE user_login ='" & txtLoginID.Text & "' AND user_password ='" & txtPassword.Text & "'"

                    Dim sqlCom As New SqlCommand   

                    sqlCom.Connection = conn

                    conn.Open()

                    Dim sqlRead As SqlClient.SqlDataReader = sqlCom.ExecuteReader
                    If sqlRead.Read() Then

                        frmIntake.Show()

                        Me.Hide()

                End Try

        End Sub

    Tuesday, June 17, 2014 6:59 PM

Answers