SHARE
TWEET

Untitled

a guest Jun 25th, 2019 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static boolean NonQuery(String SQL_Statement, List<String> parameters) throws SQLException {
  2.             PreparedStatement sql_statement = null;
  3.             int index = 1;
  4.             int affecteRows;
  5.             boolean flag = false;
  6.             try {
  7.                 //db_connection == null;
  8.  
  9.                 sql_statement = db_connection.prepareStatement(SQL_Statement);          
  10.                 for (String parameter : parameters) {
  11.  
  12.                     sql_statement.setString(index, parameter);
  13.                     index++;
  14.                 }
  15.                 index = 0;
  16.                 affecteRows = sql_statement.executeUpdate();
  17.  
  18.                 if(affecteRows > 0) {
  19.                     flag = true;
  20.                 }
  21.                 System.out.println(affecteRows);    
  22.             } catch (SQLException  e) {
  23.                 System.out.println("Connect is not established with the database");
  24.                 System.err.format("SQL State: %sn%s", e.getSQLState(), e.getMessage());
  25.     }
  26.        return flag;
  27.     }
  28.      
  29. CREATE TABLE [dbo].[RecordQueue](
  30.     [Id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
  31.     [RecordId] [int] NOT NULL,
  32.     [DocumentDate] [date] NOT NULL,
  33.     [RecordTypeId] [int] NOT NULL,
  34.     [Processed] [bit] NOT NULL,
  35.     [Failed] [bit] NULL,
  36.     [UpdatedDate] [datetime] NULL,
  37.     [PriorityId] [int] NOT NULL,
  38.  CONSTRAINT [PK_RecordQueue] PRIMARY KEY CLUSTERED
  39. (
  40.     [Id] ASC
  41. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  42. ) ON [PRIMARY]
  43.      
  44. USE DeedsOfficeData
  45.  
  46. INSERT INTO RecordQueue (RecordId, DocumentDate, RecordTypeId, Processed, Failed, UpdatedDate, PriorityId)VALUES (244637596, GETDATE(), 4, 0, 0, null, 1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top