Home | » | Java | » | Advance Java | » | Java Database Connectivity | » | Inserts records-GUI |
---|
This example inserts records into the Access table 'SchoolClasses' on the hard disk, using classes of java.sql and java.awt and more packages with Grapchical User Interface.
To build these concepts and skill, a 'SchoolClasses' table will be used as a working model. This table will be created in an Access database i.e. the SchoolDemo.mdb database will hold a 'SchoolClasses' table. The structure of the table will be as described below:
|
The table structure will be as follows:
Diagram 22.20 M.S Access table 'SchoolClasses' |
Since the 'SchoolClasses' table has been created and populated with upto 13-14 Test records, focus now shifts to the creation of the UI in Java. The UI will be created using Java 'Swing' objects.
The Following block of code creates the UI described using Java Swing Components.
The Output of InsertsRecords table is as shown below: |
Diagram 22.21 The Data Entry Screen for InsertsRecords.class. |
Once the UI, (as shown in diagram 22.21), has been created it is necessary to add the functionality to the UI so that it works like any standard Window's based commerical application data entry form.
Diagram 22.22 Message displayed when wrong Reg.No is entered. |
Diagram 22.23 Screen asking Do you want save this record? |
Diagram 22.23 Display message Record Successfully Inserted |
Diagram 22.24 Display message Duplicate Record is Not Allowed! |
JDBC - Working With User Interfaces - Using Swing Compoents
JDBC - Programming:
View records from the Access/SQL table. | |
Inserts records into the Access/SQL table. | |
Updates records into the Access/SQL table. | |
Deletes records from the Access/SQL table. | |
Drops the Access/SQL table. |
No comments:
Post a Comment