Hi All,
I am hoping someone can help, it's been a while since I've posted on here and it's been even longer since I've been programming.
Basically I've created a Login Screen and what I'd like to do is the following:
When the login form loads the User Combobox is populated from a users table in SQL. The Selected Item would be "USERNAME" field in the user table and the Selected Value would be the "USERID" field.
Code:
Dim cnTransportSystem As New SqlClient.SqlConnection("Data Source=EXAPPSRV02;Initial Catalog=TransportSystem;Persist Security Info=True;User ID=systemadmin;Password=*********")
Dim cmdUserList As New SqlClient.SqlCommand("SELECT USERID, USERNAME FROM USERS ORDER BY USERNAME", cnTransportSystem)
Dim drUserList As SqlClient.SqlDataReader
cnTransportSystem.Open()
drUserList = cmdUserList.ExecuteReader()
ComboBox1.DataSource = drUserList
ComboBox1.SelectedItem = "USERNAME"
ComboBox1.SelectedValue = "USERID"
drUserList.Close()
cnTransportSystem.Close()
Unfortunately this is not working and I could really do with some guidance from you guys.
This is a Windows Application which I'm creating.
THanks again!!!