String sql = "insert into tmp values ('<input type = 'button'>')";
sql = sql.replaceAll(" ' "," ' ' "); // 将单引号换成替换成俩双引号
stmt.executeUpdate(sql); // 在 sql server 2000 中测试通过。
=========================
在查询分析其中: insert into tmp values(' ''hello world'' ') // 两个单引号
本文介绍了一种在SQL语句中使用特殊字符的方法,并提供了如何正确转义单引号的具体实例。通过示例代码展示了如何在SQL Server 2000中插入带有特殊字符的数据。
2478

被折叠的 条评论
为什么被折叠?



