executeUpdate 出错 jsp

来源:百度知道 编辑:UC知道 时间:2024/06/07 05:20:54
我想更新下数据库的信息,可是,代码中stmt.executeUpdate(sqlString);这句总是提示出错,搞了半天也没有搞清楚,大家帮下忙。
代码大致如下:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%!
public String codeToString(String str)
{//处理中文字符串的函数
String s=str;
try
{
byte tempB[]=s.getBytes("ISO-8859-1");
s=new String(tempB);
return s;
}
catch(Exception e)
{
return s;
}
}
%>

<%//接收客户端提交的数据
String username=codeToString(request.getParameter("username"));
if(username==null)//无内容则设为空串
username="";
String password=codeToString(request.getParameter("password"));
if(password==null)//无内容则设为空串
password="";
String telephone_number=codeToString(request.getParameter("telephone_number"));
if(telephone_number==null)//无内容则设为空串
telephone_number="";
String name=cod

你确认你的userid和password都是number型的吗?如果不是,请在两端加上单引号.

stmt=conn.createStatement();就可以了吧?没必要带参数.

还有好象我记得close的时候要先close statement,然后close connection,也就是按stmt.close();conn.close();的顺序.

错误代码