Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with Java using eclipse with SQlite. I am creating a DVD database called Movies which would list the title, release date, and

image text in transcribedI need help with Java using eclipse with SQlite. I am creating a DVD database called Movies which would list the title, release date, and runtime. For my java program, i need to create a code that would insert movies into the table, update the table and delete stuff in the table. I've got everything to connect and have the code for insert, just need it for Update and Delete. I used a "Try/Catch' block statement for Insert with its proper SQL command to insert a movie to the table. I need try/catch block statements for update and delete with its proper sql commands. Please help! I attached what I have so far and what i need the code for Update and Delete to look like.

114 JButton btnInsert new JButton Insert btnInsert addAction Listener new Action Listener 115e public void actionPerformed ActionEvent e) 1 16 17 try 18 String query Insert INTO DVD (Title, Year, Runtime) values C?,?, Prepared Statement pStatement conn., Statement query) .prepare 119 pStatement.setStringC1, textTitle.getTextO) 120 21 p Statement setString textYear. getTextO); 22 Double time Double parse DoubleCtextRun time getTexto) pStatement.setDoubleC3, r time 124 pStatement execute JOptionPane. showMessageDialogCnull, Record Inserted into DVD table") 25 26 27 catch CException e2) 28 JOptionPane. null Error inserting record") 129 30 31 132 133 134 set Bounds(6, 243, 117, 29); 135 btn Insert frame getContent PaneC) addCbtnInsert); 136 137 JButton btnUpdate new JButtonC"Update") 138 btnUpdate addAction Listener new Action Listener CD 1 139 public void actionPerformed ActionEvent e) 1 40 41 42 43 btnUpdate 243, 117, 29) 44 frame get ContentPane() addC btn Update) 45 46 Button btnDelete new JButton "Delete 47 btnDelete. setBounds(252, 243, 117, 29) L48 frame getContent Panec). add btn Lete); 49 JScrollPane scroll Pane 1 new JScrollPaneO; 50 51 scroll Pane 1 set Bounds (189, 71, 219, 160) frame getContent PaneO. addC 152 scroll Pane 1 Source Design

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions