Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String sql;
- int show;
- int screen;
- String time;
- String date;
- for(show = 1 ; show <43 ; show++) {
- if (show%6 == 1 || show%6 == 2)
- screen = 1;
- else if (show%6 == 3 || show%6 == 4)
- screen = 2;
- else
- screen = 3;
- if (show%2 == 1)
- time = "19:00";
- else
- time = "21:30";
- if (show <= 6)
- date = "22-12-2014";
- else if (show > 6 && show <= 12)
- date = "23-12-2014";
- else if (show > 12 && show <= 18)
- date = "24-12-2014";
- else if (show > 18 && show <= 24)
- date = "25-12-2014";
- else if (show > 24 && show <= 30)
- date = "26-12-2014";
- else if (show > 30 && show <= 36)
- date = "27-12-2014";
- else
- date = "28-12-2014";
- sql = "INSERT INTO shows " +
- "VALUES (" + show + ", " + screen + ", '" + time + "', '" + date + "')";
- stmt.executeUpdate(sql);
- }
- Giver fejlen com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 1
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement