Skip to content

Commit

Permalink
Deleted Enhanced , can delete one seat at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseebUllahAbbasi committed Aug 15, 2020
1 parent 8583389 commit a891044
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Binary file modified Base.db
Binary file not shown.
21 changes: 17 additions & 4 deletions DB/src/sample/Delete.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URL;
import java.sql.*;
Expand Down Expand Up @@ -183,10 +182,24 @@ public void delete()
connection = DriverManager.getConnection("jdbc:sqlite:/home/peaceseeker/DB_project/Base.db");
//connection = DriverManager.getConnection("jdbc:sqlite:/D:/CS IBA/Semester 4/DBMS/Project/Git_Prok/DB_project/Base.db");
statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("Select * FROM Seats WHERE Cnic = '"+to_be_del.getCnic()+"'");
int count = 0;
while (resultSet.next())
{
count++;
}
if(count==1)
{
statement.execute("DELETE FROM Customer WHERE Cnic = '"+to_be_del.getCnic()+"'");
statement.execute("DELETE FROM Seats WHERE Cnic = '"+to_be_del.getCnic()+"'");
}
else if(count>1)
{
statement.execute("DELETE FROM Seats WHERE Cnic = '"+to_be_del.getCnic()+"' and [SeatNo] = '"+to_be_del.getSeat()+"'");
}

statement.execute("DELETE FROM Customer WHERE Cnic = '"+to_be_del.getCnic()+"'");
statement.execute("DELETE FROM Seats WHERE Cnic = '"+to_be_del.getCnic()+"'");

//statement.execute("DELETE FROM Customer WHERE Cnic = '"+to_be_del.getCnic()+"'");
//statement.execute("DELETE FROM Seats WHERE Cnic = '"+to_be_del.getCnic()+"'");
alert = new Alert(Alert.AlertType.WARNING,"User With "+to_be_del.getCnic()+" CNINC is Deleted", ButtonType.OK);
alert.showAndWait();
}
Expand Down

0 comments on commit a891044

Please sign in to comment.