java.sql.SQLException: [Microsoft][ODBC ??????????] 未???????源??撇???未指??默??????? 5
用javaweb实现对SQLServer数据库进行查询操作时,显示上面的结果。请问这是乱码还是其他设置问题?<%@pagelanguage="java"contentTy...
用javaweb实现对SQLServer数据库进行查询操作时,显示上面的结果。请问这是乱码还是其他设置问题?
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生信息查询</title>
</head>
<body>
<%Connection con;
Statement sql;
ResultSet rs;
try{
con=DriverManager.getConnection("jdbc:odbc:StudentCourse","sa","211314");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * from Students");
out.print("<Table Border>");
out.print("<TR><td colspan=8 align=center>用户数据</td></tr>");
out.print("<TR>");
out.print("<Td width=80>学号</td>");
out.print("<Td width=80>姓名</td>");
out.print("<Td width=50>性别</td>");
out.print("<Td width=100>出生年月</td>");
out.print("<Td width=80>所在系</td>");
out.print("<Td width=100>爱好</td>");
out.print("</TR>");
while(rs.next()){
out.print("<TR>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString(5)+"</TD>");
out.print("<TD>"+rs.getString("Sbirthday")+"</TD>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString("memo")+"</TD>");
out.print("</TR>");
}
out.print("</Table>");
con.close();
}catch(SQLException e1)
{out.print(e1);}
%>
</body>
</html> 展开
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生信息查询</title>
</head>
<body>
<%Connection con;
Statement sql;
ResultSet rs;
try{
con=DriverManager.getConnection("jdbc:odbc:StudentCourse","sa","211314");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * from Students");
out.print("<Table Border>");
out.print("<TR><td colspan=8 align=center>用户数据</td></tr>");
out.print("<TR>");
out.print("<Td width=80>学号</td>");
out.print("<Td width=80>姓名</td>");
out.print("<Td width=50>性别</td>");
out.print("<Td width=100>出生年月</td>");
out.print("<Td width=80>所在系</td>");
out.print("<Td width=100>爱好</td>");
out.print("</TR>");
while(rs.next()){
out.print("<TR>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString(5)+"</TD>");
out.print("<TD>"+rs.getString("Sbirthday")+"</TD>");
out.print("<TD>"+rs.getString(10)+"</TD>");
out.print("<TD>"+rs.getString("memo")+"</TD>");
out.print("</TR>");
}
out.print("</Table>");
con.close();
}catch(SQLException e1)
{out.print(e1);}
%>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询