请问为什么从数据库中读取的这些数据是换行出现的呢?是哪出的问题啊?
Statementst=con.createStatement();//创建连接语句ResultSetrs=st.executeQuery("select*fromStu...
Statement st = con.createStatement();//创建连接语句
ResultSet rs = st.executeQuery("select * from Stus"); //发送SQL命令,语句查询,得到结果集
System.out.println("学号:" +"姓名 " +"性别"+ "专业"+"年纪" );
while (rs.next()) {
String id = rs.getString("Num");
String name = rs.getString("Name");
String sex = rs.getString("Sex");
String grade = rs.getString("Specialty");
String year = rs.getString("Year");
System.out.println(id +name+sex+grade+year);
}
rs.close();
st.close();
con.close(); 展开
ResultSet rs = st.executeQuery("select * from Stus"); //发送SQL命令,语句查询,得到结果集
System.out.println("学号:" +"姓名 " +"性别"+ "专业"+"年纪" );
while (rs.next()) {
String id = rs.getString("Num");
String name = rs.getString("Name");
String sex = rs.getString("Sex");
String grade = rs.getString("Specialty");
String year = rs.getString("Year");
System.out.println(id +name+sex+grade+year);
}
rs.close();
st.close();
con.close(); 展开
展开全部
while (rs.next()) {
String id = rs.getString("Num");
String name = rs.getString("Name");
String sex = rs.getString("Sex");
String grade = rs.getString("Specialty");
String year = rs.getString("Year");
System.out.print(id +name+sex+grade+year);
System.out.print("");
}
String id = rs.getString("Num");
String name = rs.getString("Name");
String sex = rs.getString("Sex");
String grade = rs.getString("Specialty");
String year = rs.getString("Year");
System.out.print(id +name+sex+grade+year);
System.out.print("");
}
追问
不行啊!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询