在Text数据类型中使用PreparedStatement [英] Using preparedstatement in Text datatypes
本文介绍了在Text数据类型中使用PreparedStatement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PreparedStatement中,我需要使用哪种方法执行该类
In PreparedStatement which method i need to use execute the class
我写了类似的方法
public Text getMessage(){
return message;
}
在我班上
PreparedStatement ps;
ps=con.prepareStatement("insert into tblmessage
(message) values(?)");
ps.setString(2, usermsgmodel.getMessage());
ps.executeUpdate();
此行出现错误,提示方法getMessage返回类型为Text,因此您的setString属性无法容纳Text值"
i got an error in this line saying that "the method getMessage return type is Text, So you setString property cannot accommodate Text value "
ps.setString(1, usermsgmodel.getMessage());
推荐答案
设为
ps.setString(1, usermsgmodel.getMessage());
这篇关于在Text数据类型中使用PreparedStatement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文