|
-
May 16th, 2008, 04:21 AM
#1
Thread Starter
Lively Member
[RESOLVED] Population in VB
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
-
May 16th, 2008, 05:03 AM
#2
Re: Population in VB
You need to know the basics or the database management.
Meaning, connecting to a database and retrieving data to an object.
-
May 16th, 2008, 05:22 AM
#3
Thread Starter
Lively Member
Re: Population in VB
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.
-
May 16th, 2008, 05:35 AM
#4
Re: Population in VB
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.
-
May 16th, 2008, 05:38 AM
#5
Fanatic Member
Re: Population in VB
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
-
May 16th, 2008, 06:37 AM
#6
Thread Starter
Lively Member
Re: Population in VB
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|