Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.55 KB | None | 0 0
  1. import java.sql.Connection;  
  2.  import java.sql.DriverManager;  
  3.  import java.sql.ResultSet;  
  4.  import java.sql.Statement;  
  5.  public class Update
  6.   {  
  7.      public static Integer UpdateBands(int num1, int num2){
  8.      Update.UpdateBands1(num2, num1);
  9.      Update.UpdateBands2(num2, num1);
  10.      return(1);
  11.      }
  12.  
  13.      
  14.      public static Integer UpdateBands1(int num1, int num2){
  15.          int number=0;
  16.          number = Max.ShowMaxRank();
  17.          number++;
  18.          
  19.  
  20.      
  21.      Connection connection = null;  
  22.      ResultSet resultSet = null;  
  23.      Statement statement = null;  {
  24.  
  25.      try
  26.      {  
  27.          String fine = Testfortest.ShowBand(num2);
  28.          String fine2 = Testfortest.ShowBand(num1);
  29.          Class.forName("org.sqlite.JDBC");  
  30.          connection = DriverManager.getConnection("jdbc:sqlite:" +"/home/ovaaq/Projects/Band preferece calculator/bands.sqlite");  
  31.          statement = connection.createStatement();  
  32.          resultSet = statement  
  33.                  .executeQuery("UPDATE bands SET Rank='" + num1 + "' WHERE Name ='" + fine + "'");
  34.               }
  35.      
  36.      
  37.      catch (Exception e)
  38.      {  
  39.          e.printStackTrace();  
  40.      }
  41.      finally
  42.      {  
  43.          try
  44.          {  
  45.              resultSet.close();  
  46.              statement.close();  
  47.              connection.close();  
  48.          }
  49.          catch (Exception e)
  50.          {  
  51.              e.printStackTrace();  
  52.          }  
  53.      }  
  54.  }
  55.      return(1);
  56. }
  57.      public static Integer UpdateBands2(int num1, int num2){
  58.          int number=0;
  59.          number = Max.ShowMaxRank();
  60.          number++;
  61.          
  62.  
  63.      
  64.      Connection connection = null;  
  65.      ResultSet resultSet = null;  
  66.      Statement statement = null;  {
  67.  
  68.      try
  69.      {  
  70.          String fine = Testfortest.ShowBand(num2);
  71.          String fine2 = Testfortest.ShowBand(num1);
  72.          Class.forName("org.sqlite.JDBC");  
  73.          connection = DriverManager.getConnection("jdbc:sqlite:" +"/home/ovaaq/Projects/Band preferece calculator/bands.sqlite");  
  74.          statement = connection.createStatement();  
  75.          resultSet = statement  
  76.                  .executeQuery("UPDATE bands SET Rank='" + num2 + "' WHERE Name ='" + fine2 + "'");
  77.               }
  78.      
  79.      
  80.      catch (Exception e)
  81.      {  
  82.          e.printStackTrace();  
  83.      }
  84.      finally
  85.      {  
  86.          try
  87.          {  
  88.              resultSet.close();  
  89.              statement.close();  
  90.              connection.close();  
  91.          }
  92.          catch (Exception e)
  93.          {  
  94.              e.printStackTrace();  
  95.          }  
  96.      }  
  97.  }
  98.      return(1);
  99. }
  100.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement