当前位置: 技术问答>java相关
急急急-关于数据库纪录的修改
来源: 互联网 发布时间:2015-11-16
本文导语: 搞了一下午了,还是有问题。 源程序如下: 修改记录测试办 出错结果; 500 Servlet Exception java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 苃?-pn{?9M at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.jav...
搞了一下午了,还是有问题。
源程序如下:
修改记录测试办
出错结果;
500 Servlet Exception
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 苃?-pn{?9M
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2525)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)
at _jsp._website._change1__jsp._jspService(/website/change1.jsp:25)
at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
at com.caucho.jsp.Page.service(Page.java:280)
at com.caucho.jsp.QServlet.service(QServlet.java:161)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:452)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:395)
at com.caucho.server.http.PageCache$Entry.service(PageCache.java:256)
at com.caucho.server.http.PageCache.service(PageCache.java:105)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:406)
at com.caucho.server.http.Request.dispatch(Request.java:211)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:307)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:257)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)
好像不是数据类型的问题
我的数据库是 access
第一、四字段是数字型的
二、三是文本的
还是有问题啊
源程序如下:
修改记录测试办
出错结果;
500 Servlet Exception
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 苃?-pn{?9M
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2525)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:337)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:287)
at _jsp._website._change1__jsp._jspService(/website/change1.jsp:25)
at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
at com.caucho.jsp.Page.service(Page.java:280)
at com.caucho.jsp.QServlet.service(QServlet.java:161)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:452)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:395)
at com.caucho.server.http.PageCache$Entry.service(PageCache.java:256)
at com.caucho.server.http.PageCache.service(PageCache.java:105)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:406)
at com.caucho.server.http.Request.dispatch(Request.java:211)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:307)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:257)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)
好像不是数据类型的问题
我的数据库是 access
第一、四字段是数字型的
二、三是文本的
还是有问题啊
|
一,四
的字段="+id+"去掉''
的字段="+id+"去掉''
|
String sqldel="delete from employee where id= "+strtb+"";
String sqladd="insert into employee(id,name,gender,age) values("+strtb+",'"+strtb1+"','"+strtb2+"',"+strtb3+")";
sql语句错误,数字型的怎么能够"'"+strtn"'" 还有age也一样哦
String sqladd="insert into employee(id,name,gender,age) values("+strtb+",'"+strtb1+"','"+strtb2+"',"+strtb3+")";
sql语句错误,数字型的怎么能够"'"+strtn"'" 还有age也一样哦