我正在尝试在SQLite数据库中添加值,只有在使用if语句的Java数据库中不存在该值时。我完全糊涂了。
try{
String econ = String.valueOf(txt_economic.getText());
String malami = "Select * from MPA1 where econcd = ?";
pst = conn.prepareStatement(malami);
rs = pst.executeQuery();
while(rs.next()){
String econcdi = rs.getString("econcd");
if(econ.equals(econcdi) ){
try{
//Insert goes here
}catch(Exception e){
}