|
-
Mar 4th, 2004, 09:56 PM
#1
Thread Starter
PowerPoster
HTML Select Problem
Hey All
I hope a explain the clearly enough.
I have 2 fields from 1 table:
EmployeeID
Employee_Name
I load the ASP page and it fills a Select\DropDown list with the EmployeeName's from the database.
The user selects the name they wish from the list, changes some other details and submits the form.
Now how do i convert the employee name back to the correct Employee_ID??
Especially if their are 2 emplyee's with the same name?
cheers
b
-
Mar 4th, 2004, 11:19 PM
#2
You'll have a
<SELECT>
<OPTION Value="his_employee_id">his_employee_name</option>
....
</SELECT>
You can work with the value, no?
-
Mar 4th, 2004, 11:28 PM
#3
Hi Beacon,
Good to see you here, i thougt you left VBF.
Anyhow the most efficient way to use The ID field as its the primary key. Simply set the Value property to the EmployeeID and display Employe Name.
E.g
VB Code:
<select name="Emp_List">
<%
do while not rs.eof
response.write "<option value=" & rs("EmployeeID") & ">" & rs("EmployeeName") & "</option>"
rs.movenext
loop
%>
</select>
Now when you submit the form the EmployeeID field will be submited, now you can easily identify the rows uniquley.
e.g
VB Code:
dim EmpId
dim sql
EmpID=request.form("Emp_List")
sql="Update Employe set Emp_Location='London' Where EmployeeId=" & EmpId
conn.execute (sql)
Hope this helps.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Mar 4th, 2004, 11:29 PM
#4
-
Mar 4th, 2004, 11:30 PM
#5
And that ain't even the reason why they call me the fastest fingers in the west
-
Mar 4th, 2004, 11:35 PM
#6
-
Mar 5th, 2004, 12:26 AM
#7
Thread Starter
PowerPoster
G'day boys
How's things?
excellent...why didnt i think of that before hand.
thanks the both of you.
Yeah i left VBF for GalahTech and then for Neowin. But Neowin has know Porgramming section and GT had no users.
With my new job it's hard to browse forums for more than 10min.
But if you put up a petition in Chit Chat i could submit it too my boss. 
cheers
b
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
|