Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello I have a question (again). I

Status
Not open for further replies.

Tom123456

Programmer
Apr 2, 2003
70
SE
Hello I have a question (again). I have a dropdownlist which gets information from a table. The information is an ID and a Name (I have hidden the key in the list so the only thing that shows is the name). The dropdownlist have a name (ddl_Names) and when I run a SQL query like:

INSERT INTO
(...,...) VALUES (...,ddl_Names)

It inserts a new record with the ID not the name!!, how do I get the name instead of the ID.

Example:
1 Tom
2 Benny

The SQL query inserts the value 1, I want it to insert Tom.



- Tom
 
Tom,

I think I may know why this happens, there is an option in the properties for the combo box called

bound column

it probably has column 1 as the bound column which usually is a good way of doing things as that is the key column and most likely uniquely identifies the record.

however if you change the bound column to 2 it should use the second column and store the information from that column.


Hope that Helps

Idd
 
If the ID is used as a foreign key on another table you will need the bound column to be the first column, but you can still use the text from the second column by keying
Code:
lstItems.Column(2).Value

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top