(Chinese) Requirements: Whenever the customer is repaying a loan amount, the loan material and the amount of loans he have to be updated in the database. Create this task application. (ENGLISH) Require: When the client repay a certificate lending Money, The Lending Material and Balance Must Be Updte in Database Who Get. Please create the application of task.
Note: Cregister is stored by customer information CLOAN is its borrowing information in the bank.
Note: This program only updates the data without being done according to the repayment rules. Please pay attention when reading, and you can improve the program.
Note that the loan amount of the user who cloan loan_id is 1
Enter the repurries after logging in.
Note that the table Loan has been updated
Note: This program only updates the data without being done according to the repayment rules. Please pay attention when reading, and you can improve the program.
/ ************************************************** ****** * Program file: saving.java * Establishment time: July 01, 2004 * Established: Inberkong * Last modified: July 01, 2004 * Modifier: Inberkong * function: customer repayment loan *********************************************************** ***** / import java.sql.Connection; import java.sql.SQLException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.DriverManager; import java.awt *;. import javax .swing. *; import java.awt.event. *; import java.lang. *;
Public Class Saving Extends Jframe Implements ActionListener
{Static JFrame frameObject; static JPanel panelObject; static JLabel labelRegid; static JLabel labelPsw; static JLabel labelReturncash; static JTextField textRegid; static JPasswordField textPsw; static JTextField textReturncash; static JButton buttonLogin; static JButton buttonCheck; static ResultSet result; static Connection con; static PreparedStatement stat; static String strSql; static String reg_id; public Saving () {panelObject = new JPanel ();. frameObject.getContentPane () add (panelObject); frameObject.setDefaultCloseOperation (frameObject.EXIT_ON_CLOSE); labelRegid = new JLabel ( "labelRegid "); labelPsw = new JLabel (" labelPsw "); labelReturncash = new JLabel (" labelReturncash "); textRegid = new JTextField (15); textPsw = new JPasswordField (15); textReturncash = new JTextField (15); buttonLogin = new JButton ("Login"); ButtonCheck = New JButton ("Repay"); PanelObject.add (labelregid); PanelObject.add (TextRegID); PanelObject.add (TextPsw); Pane LOBJECT.ADD (ButtonLogin); Panelobject.Add (labelreturncash); PanelObject.add (TextReturncash); PanelObject.Add (ButtonCheck);
This.LabelreTurncash.setVisible (false); this.TextReturncash.setVisible (false); this.buttoncheck.setVisible (false);
buttonLogin.addActionListener (this); buttonCheck.addActionListener (this);} public static void main (String args []) {frameObject = new JFrame ( "credit back system"); frameObject.setDefaultCloseOperation (frameObject.EXIT_ON_CLOSE); frameObject.setVisible (true); frameObject.setSize (300,300); Saving h = new Saving ();} public void actionPerformed (ActionEvent evt) {Object obj = evt.getSource (); if (obj == buttonLogin) {String CtextRegid = textRegid. getText (); String CtextPsw = textPsw.getText (); if (CtextRegid.length () == 0) {JOptionPane.showMessageDialog (frameObject, new String () "Please enter the Regid value!");} else if (CtextPsw .length () == 0) {JOPANE.SHOWMESSAGEDIALOG ("pleme Enter the psw value!");} else {try {class.Forname ("Sun.jdbc.odbc.jdbcodbcDriver"); Connection Con; con = drivermanager.getConnection ("JDBC: ODBC: MyDataSource", "SA", "123"); strsql = "SELECT REG_ID from Cregister WHE Rereg_name =? and reg_psw =? "; stat = con?preparestatement (strsql); stat.setstring (1, textRegid.getText ()); stat.setstring (2, textpsw.getText (); result = stat.executeQuery (); If (result.next ()) {reg_id = result.getstring (1);} if (reg_id == "|| reg_id == null) {JOPNE.SHOWMESSAGEDIALOG (" Login Failed! !!! ");} else {JOPANE.SHOWMESSAGEDIALOG (" LOGIN SUCCESSED !!!! " reg_id); labelregid.setvisible (false);