In PreparedStatement which method i need to use execute the class
I write a method like
public Text getMessage(){
return message;
}
In my class
PreparedStatement ps;
ps=con.prepareStatement("insert into tblmessage
(message) values(?)");
ps.setString(2, usermsgmodel.getMessage());
ps.executeUpdate();
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());
Use this, it works fine.
Try following :
Class :
You are only inserting 1 column data in table so you have to use
1
not2
inps.setString(1,usermsgmodel.getMessage());
and one question is that where you are setting message ? I don't understand the
return message
line so I have usedHello
.Make it as