I am new to ucanaccess. I am developing a java swing application, I am using MS Access 2016 to store my DB.I am trying to insert values into my table. I am using sql's insert into query. Everything seems right, but then I am getting error saying parameter marker not allowed (I think its referring to "?" which I used to pass variables to my query).
Here is the is the DB code:
public static void updateDB(String NOBOOKS, java.util.Date DOI, java.util.Date DOR){
try{
Connection on = DriverManager.getConnection("jdbc:ucanaccess://Database/UserDetails.accdb");
Statement stmt = on.createStatement();
String sql = "SELECT * FROM Member";
System.out.println(Uid);
ResultSet result = stmt.executeQuery(sql);
System.out.println(DOR);
while(result.next()){
if(Uid.equals(result.getString("ID"))){
String N = NOBOOKS;
Date I = new Date(DOI.getTime());
Date R = new Date(DOR.getTime());
String sqlUpdate = "INSERT INTO Member (Issues,DOI,DOR) VALUES (?,?,?)";
PreparedStatement values = on.prepareStatement(sqlUpdate);
System.out.println("The DOI is "+ DOI);
System.out.println("The I is "+ I);
System.out.println("The DOR is "+ DOR);
System.out.println("The R is "+R);
values.setString(1, N);
values.setDate(2, I);
values.setDate(3, R);
stmt.executeUpdate(sqlUpdate);
}
}
}catch(Exception se){
System.out.print(se);
}
}
and this is the output i am getting.
2
Tue Sep 20 00:00:00 IST 2016
The DOI is Mon Sep 05 00:00:00 IST 2016
The I is 2016-09-05
The DOR is Tue Sep 20 00:00:00 IST 2016
The R is 2016-09-20
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 parameter marker not allowedBUILD SUCCESSFUL (total time: 25 seconds)