Am having the similar prob... & i am new to
vb.net. I have tried below coding.... but its showing ("Invalid user name/password.")even i typed the right username and password and type. Anyone can advise me?
rivate Sub ENTER_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_enter.Click
Dim conn As New SqlClient.SqlConnection("Data Source= (local); Initial catalog= CRS; user id=sa; pwd=sa")
conn.Open()
'Create a command object
Dim mycommand As New SqlClient.SqlCommand("Select Username, Password, Type from Logindata Where Username = '" & txtUsername.Text & "' AND Password = '" & txtPassword.Text & "' AND Type= '" & Combotype.Text & "'", conn)
'Execute the command
Dim dr As SqlClient.SqlDataReader = mycommand.ExecuteReader()
dr.Read()
' See if we got anything.
If dr.Read = True Then
Dim Frm2 As New Form2
Frm2.Show()
Else
MsgBox("Invalid user name/password.")
End If
dr.Close()
conn.Close()
End Sub