关于mysql语法小问题?
本来此系统数据库用的是sqlserver,不过我改用mysql。我不清楚myqsl语法,出现一些小问题。Class.forName("org.gjt.mm.mysql.D...
本来此系统数据库用的是sqlserver,不过我改用mysql。我不清楚myqsl语法,出现一些小问题。
Class.forName("org.gjt.mm.mysql.Driver");
String url="jdbc:mysql://localhost:3306/sbmanager?";
Connection conn=DriverManager.getConnection(url+"user=root&password=444444&useUnicode" +
"=true&characterEncoding=gb2312");
System.out.println("connetion ......chenggong ");
//连接数据库成功后下面是sqlserver语法
Statement stmt=conn.createStatement();
String sql = "delete from people where Id="+request.getParameter("Id");
stmt.executeUpdate(sql);
stmt.close();
conn.close();
运行后报错:javax.servlet.ServletException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
如何改才能运行? 展开
Class.forName("org.gjt.mm.mysql.Driver");
String url="jdbc:mysql://localhost:3306/sbmanager?";
Connection conn=DriverManager.getConnection(url+"user=root&password=444444&useUnicode" +
"=true&characterEncoding=gb2312");
System.out.println("connetion ......chenggong ");
//连接数据库成功后下面是sqlserver语法
Statement stmt=conn.createStatement();
String sql = "delete from people where Id="+request.getParameter("Id");
stmt.executeUpdate(sql);
stmt.close();
conn.close();
运行后报错:javax.servlet.ServletException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
如何改才能运行? 展开
1个回答
佳达源
2024-10-28 广告
2024-10-28 广告
AR0144CSSM20SUKA0-CPBR这款产品,作为我司产品线中的重要一员,集成了高精度的传感器技术与先进的图像处理算法,广泛应用于安防监控、工业自动化及机器视觉等领域。其卓越的性能与稳定性,确保了在各种复杂环境下的精准数据采集与高效...
点击进入详情页
本回答由佳达源提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询