I am creating an application in which I am using Access database. I have to insert a few values in the database but I get an error "data exception: invalid character value for cast". I cant figure out whats wrong. Here is the code:
String sql = "INSERT INTO PATIENT (MRNumber, Address, Age, Gender, Contact, CNIC, Consultant, PatientName, FatherName) " + "Values ('ABC124', 'Billi', 'Billa', 'Rafa', 21, 'Female', '123', '34343', 'Baba')";
cnnct.connect();
try {
cnnct.rs = cnnct.statement.executeQuery(sql);
//while (cnnct.rs.next()) {
//}
}
catch (Exception e) {
System.out.println(e);
}
Connect is a class where I have created the ResultSet, statement and connection objects. I am calling them here by using Connect class's object.