Finding the Unique ID Key?

RTSwimmer

New member
Joined
Nov 7, 2006
Messages
2
Location
Portsmouth, UK
Programming Experience
1-3
How can i find the ID Key if i have the object its referenced to.

Ill try to explain more...

I'm creating an app that looks into a MS Access database and find information such as filmTitle (which is listed in a listbox) when the filmtitle is selected it then shows a list of cast actors in the second listbox.

My problem is that i need to find the ID key of the film title
for example i know "Armageddon" has a ID key of 20 but how can i find out dynamically, in other words can i select a film title from the list box and it output the ID Key in the database (not the selected index value)

lstFilmTile - DataSource = DsTitles
lstFilmTile - DataMember = tblDvdItem.fldTitle

VB.NET:
   Private Sub loadTitles()
        DsTitles.Clear()
        adaptTitle.Fill(DsTitles)
    End Sub

     Private Sub loadCastList()
        lstCurrCast.Items.Clear() 'empty the listbox
        DsCastList.Clear() 'empty the dataset
        adaptCastList.SelectCommand.Parameters(0).Value = lstFilmTitle.SelectedValue 'select which dvd title to search for
        adaptCastList.Fill(DsCastList)
        For Each tempRow As DataRow In DsCastList.Tables(2).Rows
            lstCurrCast.Items.Add(tempRow(0) & " " & tempRow(1)) '0="fldActorName1st" 1="fldActorNameLast"
        Next
    End Sub
I hope someone understands my problem, if it makes it easier ill give you access to the project files so you can see what i mean

Thanks RTSwimmer
 
Why dont you download the ID at the same time as the title, put the ID in as the ValueMember of the combo, and the name in as the DisplayMember?

For more information, read the DW2 link in my signature, google search the msdn site for DisplayMember and ValueMember, or search these forums.. the terms come up quite a lot
 
Back
Top