Netbeans 在数据库don'中插入记录;t工作,使用if-else和preparedStatement

Netbeans 在数据库don'中插入记录;t工作,使用if-else和preparedStatement,netbeans,Netbeans,我想检查数据库中是否存在我的记录 意思 如果记录不在数据库中, 它将执行此查询并在数据库中更新它。 然而, 当我运行代码时, 没有任何错误, 但是只是没插进去。 我尝试过null&.equals(“”) 请尝试在if语句之前打印member_id的值。my insert语句计算结果良好是否确定它位于if块内?如果else正在工作,则表示它从未输入if,这表示您的insert语句从未执行数据库中的所有列都定义为字符串?没有整数? if (member_ID == null) { Prepar

我想检查数据库中是否存在我的记录 意思 如果记录不在数据库中, 它将执行此查询并在数据库中更新它。 然而, 当我运行代码时, 没有任何错误, 但是只是没插进去。 我尝试过null&.equals(“”)


请尝试在if语句之前打印member_id的值。my insert语句计算结果良好是否确定它位于if块内?如果else正在工作,则表示它从未输入if,这表示您的insert语句从未执行数据库中的所有列都定义为字符串?没有整数?
 if (member_ID == null)
 {
 PreparedStatement pstmtInsert = conn.prepareStatement(
"INSERT INTO Customers (MembershipID, Contact, Email, Address, SurveyStatus, Subscription) VALUES (?, ?, ?, ?, ?, ?)");

    pstmtInsert.setString(1,member_ID);
          pstmtInsert.setString(2,contact_num);
          pstmtInsert.setString(3,email_add);
          pstmtInsert.setString(4,mail_add);
          pstmtInsert.setString(5,radio_group);
          pstmtInsert.setString(6,receive_info);         
          pstmtInsert.executeUpdate();
           pstmtInsert.close();
 }