
this code is not working! please help me to find error. thanks.
<%@ page import="java.sql.*" %>
<%
Connection con=null;
String user=request.getParameter("userid");
session.putValue("userid",user);
String pwd=request.getParameter("pwd");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
con = DriverManager.getConnection("jdbc:odbc:mydb","","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from table1 where userid='"+user+"' and pwd='"+pwd+"'");
int i=0;
while(rs.next()){
i++;
}
if(i>0){
out.println("welcome " +user);
}
else{
response.sendRedirect("login.html");
}
}
catch(Exception e){
System.out.println(e);
}
%>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
