日期:2014-05-17 浏览次数:20711 次
<select name="name"> <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:tscgdb","sa","sa"); Statement stat = con.createStatement(); ResultSet rs = stat.executeQuery("select * from books"); while(rs.next()){ %> <option value="<%=rs.getString("bookname")%>"> <%=rs.getString("bookname")%></option> <% } rs.close(); %> </select>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:tscgdb","sa","sa"); Statement stat = con.createStatement(); ResultSet rs = stat.executeQuery("select * from books"); while(rs.next()){ String name = rs.getString("bookname"); %> <option value="<%=name%>"> <%=name%></option> <% } rs.close(); %>