<%@page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<%
String username=(String)session.getAttribute("username");
out.print(username);
String DBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
String ConnStr="jdbc:odbc:xuanke";
String sql="select * from Student where Stuno='"+username+"'";
String temp1,temp2,temp3,temp4,temp5,temp6;
//int temp55='否',temp66=0;
try
{
Class.forName(DBDriver);
}
catch(java.lang.ClassNotFoundException e)
{
System.err.println("database:"+e.getMessage());
out.println("驱动未能加载");
}
try
{
Connection conn=DriverManager.getConnection(ConnStr," "," ");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
temp1=rs.getString("StuNo");
temp2=rs.getString("ClassNo");
//将记录集或者变量中的数据显示到表单的文本框中
%>
<p>添加课程:</p>
<form id="form1" name="form1" method="post" action="../xuesheng/tianjiaup.jsp">
<table width="70%" height="136" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="24"> 学号/姓名</td>
<td><label>
<input name="xm" type="text" id="xm" value="<%=temp1%>" disabled="disabled"/>
</label></td>
</tr>
<tr>
<td height="24"> 课程</td>
<td><label>
<select name="select">
<% while(rs.next()){%>
<option value="<%=temp1%>">"<%=temp1%>"</option>
<%}%>
</select>
</label></td>
</tr>
<%out.print("ppppp"+(rs.getString("StuNo")));%>
<tr>
<td> </td>
<td><p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label>
</p>
<p> </p></td>
</tr>
</table>
</form>
<%
}
rs.close();
stmt.close();
conn.close();
} catch(SQLException e)
{
System.err.println("executeQuery:"+e.getMessage());
out.println("数据未能读出");
return;
}%>
<%
String username=(String)session.getAttribute("username");
out.print(username);
String DBDriver="sun.jdbc.odbc.JdbcOdbcDriver";
String ConnStr="jdbc:odbc:xuanke";
String sql="select * from Student where Stuno='"+username+"'";
String temp1,temp2,temp3,temp4,temp5,temp6;
//int temp55='否',temp66=0;
try
{
Class.forName(DBDriver);
}
catch(java.lang.ClassNotFoundException e)
{
System.err.println("database:"+e.getMessage());
out.println("驱动未能加载");
}
try
{
Connection conn=DriverManager.getConnection(ConnStr," "," ");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
temp1=rs.getString("StuNo");
temp2=rs.getString("ClassNo");
//将记录集或者变量中的数据显示到表单的文本框中
%>
<p>添加课程:</p>
<form id="form1" name="form1" method="post" action="../xuesheng/tianjiaup.jsp">
<table width="70%" height="136" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="24"> 学号/姓名</td>
<td><label>
<input name="xm" type="text" id="xm" value="<%=temp1%>" disabled="disabled"/>
</label></td>
</tr>
<tr>
<td height="24"> 课程</td>
<td><label>
<select name="select">
<% while(rs.next()){%>
<option value="<%=temp1%>">"<%=temp1%>"</option>
<%}%>
</select>
</label></td>
</tr>
<%out.print("ppppp"+(rs.getString("StuNo")));%>
<tr>
<td> </td>
<td><p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label>
</p>
<p> </p></td>
</tr>
</table>
</form>
<%
}
rs.close();
stmt.close();
conn.close();
} catch(SQLException e)
{
System.err.println("executeQuery:"+e.getMessage());
out.println("数据未能读出");
return;
}%>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货