SoFunction
Updated on 2025-04-08

How to use the drop-down list to display the content in the database?

' Create a record set and search

'
Use forward cursors (0) and read-only mode (1) Open the record set
'
If specificidThe request is read, and then the
If Len(("id")) <> 0 Then
      '
according toidRead the corresponding record
      "select * from intelsdb WHERE id"), objDC, 0, 1
      '
Show selected records
      If Not Then
           
            %>
            <TABLE BORDER=2>
                  <tr>
                        <td><B>ID </B></td>
                        <td><B>
Name</B></td>
                        <td><B>
department</B></td>
                        <td><B>
Monthly Sales</B></td>
                  </tr>
                  <tr>
                        <td ALIGN="center"><%= ("id") %></td>
                        <td ALIGN="left"><%= ("name") %></td>
                        <td ALIGN="left"><%= ("department ") %></td>
                        <td ALIGN="right"><%= ("sales") %></td>
                  </tr>
            </TABLE>
            <%
      End If
     
End If

"intelsdb", objDC, 0, 1
'
Read the record set in a loop and display the results
If Not Then
     
      '
The following table will be called this timeQueryString insideidContents
      %>
      <FORM ACTION="./db_pulldown.asp" METHOD="get">
      <select NAME="id">
            <OPTION></OPTION>
      <%
      '
Until the record set is finished.
      Do While Not
            '
For each record, for the employeeidCreate a selection tag and set the corresponding value
            %>
            <OPTION VALUE="<%= ("id") %>"><%= ("name")  %></OPTION>
            <%
      '
Get the next record
     
      Loop
      %>
      </select>
      <INPUT type="submit" value="Submit">
      </FORM>
      <%
End If

'
Close and clear

Set objRS =  Nothing

Set objDC = Nothing
%>