while(rs.next())
{
String key=rs.getString(1);
String val=rs.getString(2);
it=ar1.get(k).toString();
if(it.trim().equals(key.trim()))
{
val=val.substring(1);
val=val+"1";
}
else
{
val=val.substring(1);
val=val+"0";
}
st = con.prepareStatement("update win set seq=? where keyy=?");
st.setString(1,val);
st.setString(2,key); //here i am getting exception
st.executeUpdate();
st.close();
}
if i change data type of seq and keyy in table as text then it shows The data types text and text are incompatible in the equal to operator
Haven't messed with TEXT data type in forever. But, leaving aside the questions about the wisdom of text "key" columns, you'll need to use
like
. You cannot use standard comparison operators onTEXT
andNTEXT
(=,<=, etc). You can leave out the wildcards, so it'll behave like an exact match. So if yourkeyy
column is text:BTW,
TEXT
andNTEXT
have been deprecated for several versions of SQL Server, I'm sure that one of these days they're going to drop it. You should probably look into converting toCHAR
andVARCHAR
.