hello all!
i am trying to compare date and time but have an error like:
SQLException: Can not issue data manipulation statements with executeQuery().
SQLState: S1009
VendorError: 0
my db look like that:
CREATE TABLE calendar (
id INT,
MYUSER VARCHAR(30) NOT NULL,
title VARCHAR(100) NOT NULL,
date DATE NOT NULL,
start TIME,
end TIME
);
and the function is:
public void deleteCalendarEvent(int id,String date,String start) throws ClassNotFoundException {
try {
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
Date Date = df.parse(date);
DateFormat sdf = new SimpleDateFormat("hh:mm:ss");
Date stime = sdf.parse(start);
// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
connect = DriverManager
.getConnection("jdbc:mysql://localhost/feedback?"
+ "user=sqluser&password=sqluserpw");
// Statements allow to issue SQL queries to the database
statement = connect.createStatement();
// Result set get the result of the SQL query
resultSet = statement
.executeQuery( "delete * from FEEDBACK.COMMENTS where id = '"+id+"' and date='"+Date+"' and start='"+stime+"'");
System.out.println("the event was deleted");
thanks all