我有一个TextArea和几行文字。当我通过getText()方法提取String时,我得到的是一行文本,而不是真正写几行。那么我该如何区分TextArea中的每一行?
答案 0 :(得分:0)
像这样使用 .replaceAll ,
String sq = "SELECT username FROM login where username = '"+value1+"'";
if (sq.equals(value1)){
JOptionPane.showMessageDialog(null,"username is already existed! please
create new username.");
}
else{
int k=st.executeUpdate("insert into
login(username,password,firstname,lastname,address,contactno)
values('"+value1+"','"+value2+"','"+value3+"','"+value4+"',
'"+value5+"','"+value6+"')");
JOptionPane.showMessageDialog(null,"Data is successfully saved");
}