I'm trying to populate my textboxs with data from my database when the user name is selected but I'm having trouble getting the code right. Help Please!
table
users (there is a textbox for each of these fields)
password
lastname
firstname
Using upcmd As New SqlCommand("SELECT * FROM users WHERE userid = @userid", connection)
upcmd.Parameters.Add(New SqlParameter("@userid", Me.txtuseridprofile.Text))
upcmd.Connection.Open()
Try
upcmd.ExecuteNonQuery()
Catch ex As SqlException
If ex.Number <> 0 Then
ErrorProvider1.SetError(Me.txtuseridprofile, "Login Id: " &
Me.txtuseridprofile.Text & " :Not Found!")
upcmd.Connection.Close()
Exit Sub
End If
End Try
upcmd.Connection.Close()
MessageBox.Show("Login ID Found. Update data and Click Go!")
Thanks in advance!