当前位置: 技术问答>java相关
高手指点--关于操作数据库(在线等待)
来源: 互联网 发布时间:2015-11-16
本文导语: 修改数据库纪录:采用先删除,后插入的方法 源程序如下: 修改记录测试办 报错如下: 500 Servlet Exception java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 苃?-pn{?9M at sun.jdbc.odbc.JdbcOdbc.cre...
修改数据库纪录:采用先删除,后插入的方法
源程序如下:
修改记录测试办
报错如下:
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)
--------------------------------------------------------------------------------
Resin 1.1.3 -- Thu Jun 29 12:04:45 PDT 2000
源程序如下:
修改记录测试办
报错如下:
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)
--------------------------------------------------------------------------------
Resin 1.1.3 -- Thu Jun 29 12:04:45 PDT 2000
|
你的ID是什么类型的如果是int型的,插入要改成
String sqladd="insert into employee(id,name,gender,age) values("+strtb+",'"+strtb1+"','"+strtb2+"','"+strtb3+"')";
String sqladd="insert into employee(id,name,gender,age) values("+strtb+",'"+strtb1+"','"+strtb2+"','"+strtb3+"')";
|
sqldel="delete from employee where id= '"+strtb+"'";
另一个问题如lgcfm(一王情深---芙蓉王)所说
另一个问题如lgcfm(一王情深---芙蓉王)所说
|
看看ID的参数类型对吗
|
你用UPDATE不可以吗?
一个SQL语句就解决,你这样好象是删除没提交,就可是插入
一个SQL语句就解决,你这样好象是删除没提交,就可是插入