<script>ec(2);</script> <% sql="SELECT * FROM [部门]" rs.open sql,conn while not rs.eof response.write("<option value="""&rs("id")&""">"&rs("name")&"</option>") wend %> 上面是把数据库中的值生成html代码了,也就把相应的值给了select供用户选择 <tr> <td align=right bgcolor="#eeeeee">部门:</td> <td bgcolor="#eeeeee"><select name=bm > <% sql="SELECT * FROM [部门]" rs.open sql,conn while not rs.eof response.write("<option value="""&rs("id")&""">"&rs("部门名称")&"</option>") wend %> </select></td> </tr> <% set rs = server.CreateObject ("adodb.recordset") sql = "select * from [人员]" rs.Open sql,conn1,1,3 rs.AddNew rs("部门") = Request("bm") rs.Update %>
|