Skip to main content
Known Participant
October 6, 2006
Question

Get the Selected from List (Drop Down List) and Find the associated Primary Key from Database

  • October 6, 2006
  • 1 reply
  • 254 views
Hi,

I'm doing a web application with mysql as my database.
I have a List with dynamic values from my database. (The values can appear)
The values are names of people.. E.g. Amy, Ali, Bobby....
This is a insert function i'm doing...

When the user selects a name from the list. E.g. Amy
I need to know the ID of this person.
That is, my database contains a table 'Adult' and the columns are ID (primary key), name (amy, ali...) , etc..

Because this insert function i'm doing is on another table name 'Child' .. In this 'Child' table, there's a foreign key of the ID in Adult table. thus when inserting a new row for the child, i need to insert the associated adult which is the ID.

Hope you understand what i'm saying..
Anyway i use Visual Basic before and using the codes of VB... what i thinking was it seems like. ... (this is just a rough coding as i already forget the accurate codings)

ListBox1.Selected = varName
select ID from Adult where name = 'varName'

then i have to store the result i got into a hidden field so as to perform the insert command with the resulted id...

Thanks.
This topic has been closed for replies.

1 reply

October 23, 2006
Hi,
Did you ever find a solution to your problem? I am having the same exact problem and have not gotten any answers.

Lisa
lisa@paraproductions.com
J-GirlAuthor
Known Participant
October 25, 2006
nope. did not found the solution. *sighs