你试一下将异常打印出来,看一下是什么问题try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:panchang");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
mystr1="delete * from employee where id = '" + mystr + "'";
stmt.executeUpdate(mystr1);
stmt.close();
conn.close();}catch (SQLException e){out.print(e);}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:panchang");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
mystr1="delete * from employee where id = '" + mystr + "'";
stmt.executeUpdate(mystr1);
stmt.close();
conn.close();}catch (SQLException e){out.print(e);}
解决方案 »
- servlet中页面转发的问题forward和redirect
- 获取图片路径问题
- ***DisplayTag***大家帮忙。中文导出excel速度慢问题。
- 一个JSP文件怎么获得另外JSP文件中的变量参数
- 麻烦帮我看看这是什么原因!在tomcat上配置的web应用 500代号!
- JSP中的菜鸟问题——————在线等待!!!!
- struts的 html:link 标记的传参问题
- 菜鸟问题:为什么我的JSP文件不能用<jsp:setProperty>和<jsp:getProperty>指令?
- 动态报表设计、显示等问题,目前偶权限底最多给100分:)不够可再给,请大家都来看看,高手解决问题得分,其它兄弟up全部有分!
- useBean问题,请多指教!
- 请教关于数据库问题
- 如何配置Tomcat4.1.12,建一个开发目录,如何设置
改成mystr1="delete * from employee where id = " + mystr + ";
因为你的字段id是数字,不是文本类型
可是到我加上if else后,总告诉:else without if
catch without try天啊,我晕了
1.delete中不使用*
2.字段类型不一致,id是数字,不要加引号,但如果mystr是String类型的,则需要转换
mystr1="delete from employee where id = " + Integer.parseInt(mystr);