Problem with accessing database.

genu

Well-known member
Joined
Jun 9, 2005
Messages
94
Programming Experience
1-3
Hello, I've started working on this program to make my life at work a bit easier, but I got stuck. Basically I have a blank access database that my program connects to, I'm able to add records to it, and delete. I made a listbox to display all the records (just the "Name" column), and I want to retried the whole record information when they double click that record name in the listbox. Db programming is pretty new to me, and I attached the project if anybody wants to help me out. Basically After they doulbe click the record in the listbox on the right, I need to be able to load the the whole record information into some variables...

thx
 

Attachments

  • ACD-Bidders.zip
    40.5 KB · Views: 22
Last edited by a moderator:
Your first query should get the the primary key column as well as the Name. Once you've populated your DataTable you would then bind it to the ListBox like so:
VB.NET:
myListBox.DisplayMember = "Name"
myListBox.ValueMember = "ID"
myListBox.DataSource = myDataTable
This assumes your PK is named "ID". Now, when the user makes a selection you can get the associated PK from the SelectedValue property of the ListBox. You can then use that value to requery the database to get the whole record.
 

Latest posts

Back
Top