Hi, Hope you can help. I am trying to populate a dropdownlist with a list of the usernames that are stored in my Access database so that the users dont have to keep running upto me and ask for there username. Thanks in advance
Printable View
Hi, Hope you can help. I am trying to populate a dropdownlist with a list of the usernames that are stored in my Access database so that the users dont have to keep running upto me and ask for there username. Thanks in advance
You need to know the basics or the database management.
Meaning, connecting to a database and retrieving data to an object.
Hi thanks for the reply i dont have my application at the minute im at work (YAY) so i will try and remember off the top of my head
Dim connectionString As String =
("provider=Microsoft.Jet.OLEDB.4.0;" + "data source = W:\Apps\Mgmt\data.mdb")
hope this helps.
Ok.
What i meant was that if you know how to get your data from the database there are many ways to use it.
If you get the data then you can fill a dataset and populate your controls by setting their binding properties or by manually feeding the data.
There are many articles here and on msdn on how you can do that.
here is an example of manual feeding of data
vb Code:
Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Your connection string") Dim Command As SqlClient.SqlCommand = New SqlClient.SqlCommand("SELECT UserName FROM UserNameTable") Try connection.Open() Dim reader As SqlClient.SqlDataReader = Command.ExecuteReader If reader.HasRows Then While reader.Read Me.ComboBox1.Items.Add(reader.Item("Username").ToString) End While reader.Close() End If Catch ex As Exception Debug.WriteLine(ex.ToString) Finally connection.Close() End Try
Hi, Thanks for that ill give it a try, looks the part let you know how i get on
Many Thanks
Stuart Jones
Network Manager