在线等,急!JSP更新数据库问题,没有错误,为什么功能不能实现呢
<%@ page contentType= "text/html;charset=gb2312 "%>
<%@ page language= "java " import= "java.sql.* "%>
<html>
<head>
</head>
<% ;String id=request.getParameter( "id ");id = new String(id.getBytes( "ISO8859_1 "), "gb2312 ");%>
<%=id%>
<%
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
String url = "jdbc:mysql://localhost:3306/paper?useUnicode=true&characterEncoding=gbk ";
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
String sql = "update student set scheck = scheck+1 where spaper = ' "+id+ " ' ";
sql = new String(sql.getBytes( "ISO8859_1 "), "gb2312 ");
sql = sql.trim();
stmt.executeUpdate(sql);
stmt.close();
conn.close();
%>
我要做的是跳这个这页面后,数据库SCHECK自段+1,为什么不能实现呢?
------解决方案--------------------请问scheck字段的类型是什么?
------解决方案--------------------set scheck=convert(convert(scheck,varchar,int)+1,int,varhcar)不知道行不行
set scheck=convertconvert(scheck,varchar,int)+1也不知道行不行