本人用JSP连接SQL SERVER 2000 可是.... 在这句的前面加一句rs.next(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 安全点的话先判断rs.next()!=null 可以这样啊:String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; String sConnStr = "jdbc:odbc:bmanager"; String sLogin = "sa"; String sPassword = "282708"; String sql; Connection conn = null; ResultSet rs = null; Statement stmt; try{ Class.forName(sDBDriver); }catch(ClassNotFoundException e){System.out.println(e);} try{ sql="select * from systypes"; Class.forName(sDBDriver); conn = DriverManager.getConnection(sConnStr, sLogin, sPassword); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); rs.next(); String name=rs.getString("name"); rs.close(); stmt.close(); conn.close(); }catch(SQLException e){System.out.println(e);} Struts2使用json返回值类型时的数据校验 jsp的小问题 请大神指点一下 说我是未定义类型 Hibernate缓存 求助一个java的问题,关于socket。。。 JSF提交页面后,URL的参数丢失? resin下使用<jsp:attribute 标签遇到的问题 连接数据库!!!我都快要疯了!!!!帮帮忙啊!!! Tomcat 5 如何配置数据库连接池???? 哪里有免费的JSP主机啊? springBoot启动成功,访问出现以下问题 有关class的目录的问题 怎样才能不让用户选定网页上的内容?
rs.next()!=null
String sConnStr = "jdbc:odbc:bmanager";
String sLogin = "sa";
String sPassword = "282708";
String sql;
Connection conn = null;
ResultSet rs = null;
Statement stmt;
try{
Class.forName(sDBDriver);
}catch(ClassNotFoundException e){System.out.println(e);}
try{
sql="select * from systypes";
Class.forName(sDBDriver);
conn = DriverManager.getConnection(sConnStr, sLogin, sPassword);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
rs.next();
String name=rs.getString("name");
rs.close();
stmt.close();
conn.close(); }catch(SQLException e){System.out.println(e);}