I've been writing code to develop gatepass system for my college. I've to made space for taking the photograph of the visitor taken by the camera at gates and then save the whole page in the database(actually the structure is already defined). Please suggest what to do.The code I've made till now is:=

import javax.swing.*;
import java.awt.*;

public class gatepass{
  public static void main(String[] args){
   JLabel visitorid=new JLabel("VISITOR ID",JLabel.CENTER);
   JLabel name=new JLabel("NAME",JLabel.CENTER);
   JLabel fathername=new JLabel("FATHER'S NAME",JLabel.CENTER);
   JLabel contact=new JLabel("CONTACT NO.",JLabel.CENTER);
   JLabel address=new JLabel("ADDRESS",JLabel.CENTER);
   JLabel meetwhom=new JLabel("MEET WHOM",JLabel.CENTER);
   JLabel purpose=new JLabel("PURPOSE",JLabel.CENTER);
   JLabel vehicle=new JLabel("VEHICLE",JLabel.CENTER);
   JLabel person=new JLabel("NO. OF PERSON",JLabel.CENTER);
   JLabel remark=new JLabel("REMARKS",JLabel.CENTER);


   JTextField visitorid1 = new JTextField(7);
   JTextField name1 = new JTextField(30);
   JTextField fathername1 = new JTextField(30);
   JTextField contact1 = new JTextField(10);
   JTextField address1 = new JTextField(100);
   JTextField meetwhom1 = new JTextField(30);
   JComboBox purpose1 = new JComboBox();
   purpose1.addItem("personal");
   purpose1.addItem("official");
   JTextField vehicle1 = new JTextField(100);
   JComboBox person1=new JComboBox();
   person1.addItem("1");
   person1.addItem("2");
   person1.addItem("3");
   person1.addItem("4");
   JTextField remark1 = new JTextField(100);

   
   visitorid.setLabelFor(visitorid1)   ;
   name.setLabelFor(name1);
   fathername.setLabelFor(fathername1);
   contact.setLabelFor(contact1);
   address.setLabelFor(address1);
   meetwhom.setLabelFor(meetwhom1);
   purpose.setLabelFor(purpose1);
   vehicle.setLabelFor(vehicle1);
   person.setLabelFor(person1);
   remark.setLabelFor(remark1);


   JPanel p=new JPanel();
   p.setLayout(new GridLayout(15,0,0,0));
   p.add(visitorid);
   p.add(visitorid1);
   p.add(name);
   p.add(name1);
   p.add(fathername);
   p.add(fathername1);
   p.add(contact);
   p.add(contact1);
   p.add(address);
   p.add(address1);
   p.add(meetwhom);
   p.add(meetwhom1);
   p.add(purpose);
   p.add(purpose1);
   p.add(vehicle);
   p.add(vehicle1);
   p.add(person);
   p.add(person1);
   p.add(remark);
   p.add(remark1);


   JButton save=new JButton("Save");
   JButton refresh=new JButton("Refresh");
   JButton print=new JButton("Print");
   

   p.add(save);
   p.add(refresh);
   p.add(print);

   JLabel msg=new JLabel("it is save and now print",JLabel.CENTER);

   



   JFrame f = new JFrame();
//f.addWindowListener(new BasicWindowMonitor());
JRootPane root=f.getRootPane();
   root.setDefaultButton(save);
Container content = f.getContentPane();
content.setLayout(new BorderLayout(2,3));
content.add(msg, BorderLayout.CENTER);
content.add(p, BorderLayout.SOUTH);
f.setSize(20,10);
f.setContentPane(p);
f.pack();
f.setVisible(true);
}
}

Can you suggest how I can proceed as I'm able to access the data using getText().But not able to save the data in database.

Do you know how you use SQL API? Which database system are you using? (Oracle,MySql,Ms-Access).

This article has been dead for over six months. Start a new discussion instead.