values in select(drop-down box)from database and u

Results 1 to 2 of 2

Thread: values in select(drop-down box)from database and u

  1. #1
    Amaldar Guest

    Default values in select(drop-down box)from database and u

    1&#062; I want to generate values from Database in select box and using onchange event,The value which is selected in select box will be stored and dependin upon the value , I want to pick up another values from database.How do I do that?<BR>2&#062;I dont want to get duplicate values from database.which SQL command is for that?<BR>Plese help me.<BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: values in select(drop-down box)from database a

    first you would have to create you record set. so lets pretend we are looking for a list of employees and thier employeeID&#039s would be the value in the select field. lets assume the recordset is called RS.<BR><BR>Set RS = dbconn.Execute("Select EmployeeID, employeename from employees")<BR><BR>&#060;select name="employee"&#062;<BR>&#060;%Do while not RS.EOF%&#062;<BR>&#060;option value="&#060;%=RS("EmployeeID")%&#062;"&#062;&#060 ;%=RS("EmployeeName")%&#062;&#060;/option&#062;<BR>&#060;%RS.MoveNext<BR>loop%&#062;< BR>&#060;/select&#062;<BR><BR>This shall effetively give you a drop down box with all the employee names, with thier employeeID&#039s as the values.<BR><BR>For your second question when you want to select a set of unique values from a database you would use the keywork "DISTINCT".<BR><BR>eg: "SELECT distinct employeeID from employees"<BR><BR>this shall return a recordset containing all the unique employeeID&#039s<BR><BR>Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts