首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

从没遇到过的有关问题

2011-12-20 
从没遇到过的问题 高手进在线等登陆运行后出现错误[Microsoft][ODBCMicrosoftAccessDriver]参数不足,期待

从没遇到过的问题 高手进 在线等
登陆   运行后   出现错误[Microsoft][ODBC   Microsoft   Access   Driver]   参数不足,期待是   1。  

代码如下: <%@   page   contentType= "text/html;   charset=gb2312 "   %>
<%@   page   import= "java.sql.* "   %>
<html>
<head>
<script   language= "javascript "   type= "text/javascript ">
<!--
function   onClick()
{
  this.location.replace( "register.jsp ");
  }
-->
</script>
<title> 用户登录                                                                                                                                                                                                                                                                                                                                                                 </title>
<style   type= "text/css ">
<!--
.STYLE2   {color:   #000000}
.STYLE3   {font-size:   x-large}
-->
</style>
</head>
<body>
<%  
try
{
String   strId= " ";
String   strName= " ";
String   strPassword= " ";
String   strMsg= " ";session.setAttribute( "loginId ", " ");
strId=request.getParameter( "id ");
strPassword=request.getParameter( "password ");

if(strId!=null   &&   strPassword!=null   &&   !strId.equals( " ")&&!strPassword.equals( " "))
{

Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");  
Connection   con=DriverManager.getConnection( "jdbc:odbc:yunshu ");
          Statement   statement=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);    
              ResultSet   rs=null;  
String   String_SQL= "select   id   from   gly   where   id= ' "+strId+ " '     and     password= ' "+strPassword+ " ' ";
rs=statement.executeQuery(String_SQL);


if(!rs.next())
{

strMsg= "你输入的用户名或密码不正确,请重新输入! ";

out.println( "123 "+strMsg);
%>
<script   language= "javascript "   type= "text/javascript ">
<!--  
alert( "重新输入 ");
-->
</script>
<%  
}
else


{
session.setAttribute( "loginId ",strId);
response.sendRedirect( "main.jsp ");
            rs.close();
            statement.close();
            con.close();
          }
        }
}
catch(Exception   e)
{
out.println( "错误 "+e.getMessage());
}
%>
<center>
    <p> <br>
        <span   class= "STYLE2 "> <span   class= "STYLE3 "> 运输管理系统 </span> </span> </p>
    <form   action= "login.jsp "   method= "post ">
        <table   width= "258 "   border= "1 ">
            <tr>
                <td   width= "37 "> ID: </td>
                <td   width= "147 "> <input   type= "text "   name= "id "> </td>
            </tr>
            <tr>
                <td> 密码: </td>
                <td> <label>
                    <input   type= "password "   name= "password ">
                </label> </td>
            </tr>
        </table>
    <p>
        <input   type= "submit "   value= "登陆 ">
        <input   type= "reset "   value= "重填 ">
        <input   type= "button "   onClick= "onClick() "   value= "注册 ">
    </p>
    </form>
   
    <p> &nbsp;     </p>
    <p> <span   class= "STYLE2 "> <br>
    </span>     </p>
</center>
</body>
</html>

[解决办法]
这个一般是sql语句的问题

你最好打印你的语句出来,并且加上调试行,看到底那一步跳出了程序

热点排行