qq_40445897
qq_40445897
2017-10-10 05:36

ResultSet rs = stmt.executeQuery(sql);存在异常

  • 异常
  • sql

这是我整个的代码,不知道这句话的问题所在,求大神帮帮忙
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



Insert title here

会员名称
会员密码

<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); //加载驱动、
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=liuben";
String user="sa";
String password="961213";
Connection conn= DriverManager.getConnection(url,user,password);

       String sql="select * from t_user where username=? and password=?";
       PreparedStatement stmt=conn.prepareStatement(sql);

       String a=request.getParameter("name");
       String b=request.getParameter("psword");
       stmt.setString(1,a);
       stmt.setString(1,b);
       ResultSet rs = stmt.executeQuery();

conn.close();

%>

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换