300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > unknown column ‘xxx‘ in ‘where clause‘的错误

unknown column ‘xxx‘ in ‘where clause‘的错误

时间:2019-11-05 18:40:21

相关推荐

unknown column ‘xxx‘ in ‘where clause‘的错误

该错误是MySQL数据库,拼接SQL语句执行时,条件字符串传值时未加引号导致。

比如:以下方法调用时需要传入两个参数:查询列、条件列

fun getString(column: String, conditions: String):String = this.connection.prepareStatement("select $column from ${this.name} where $conditions limit 1").executeQuery().getString()

调用:条件传值时,需要拼接上双引号

val mainTable = connection.table("sys_user")val mainId = mainTable.getString("id","area="+'"'+entity.area+'"'+" and type="+'"'+entity.code+'"')

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。