i want my code to validate date according to format , day month aslo it shoud not exceed day month value…and even if i enter in any format mm/dd/yyyy or mm/dd/yyyy or yyyy/mm/dd it should validate all because ms access support all format.
and how to udate it also for that my code is:
Connection connection;
String text = txtUpdate.getText();
int Update = Integer.parseInt(text);
String Name = txtName.getText();
String Email = txtEmail.getText();
String Mobile = txtMobile.getText();
String Address = txtAddress.getText();
String Dob = txtDob.getText();
if (check_Name() && check_Email() && check_Mobile() && check_Address() && check_Dob()) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:NewPData");
String query = "update Table1 set Name='" + Name + "' , Email='" + Email + "' , Mobile=" + Mobile + ", Address= '" + Address + "', DOB=" +Dob + ", where ID=" + Update;
PreparedStatement ps_Statement = connection.prepareStatement(query);
ps_Statement.executeUpdate();
JOptionPane.showMessageDialog(panelID, "Record Updated Successfully");
connection.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
DO THIS