Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Create Reports in Java with access database

Have Programming Question? Ask it here!
 
 
 


sushant
Create Reports in Java with access database
1 Answer(s)      4 years ago
Posted in : Java Beginners


Hello Sir How to Create Reports of Any Type using Java when i submit data is stored in the MS access database,but when I click on PRINT Button then it will display it into either Text File or any type of Report and then i want to print it.
How I can Generate it plz help Me

Advertisement
View Answers

April 21, 2010 at 12:25 PM


Hi Friend,

We are providing you code that will display the data into textfile on clicking Print Button.

Try the following code:

import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
class Form extends JFrame{

JButton ADD;
JPanel panel,pan;
JLabel label1,label2,label3,label4,label5;
final JTextField text1,text2,text3,text4,text5;
Form() {
label1 = new JLabel();
label1.setText("Employee Id:");
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("Employee Name:");
text2 = new JTextField(20);

label3 = new JLabel();
label3.setText("Employee Designation:");
text3 = new JTextField(20);

label4 = new JLabel();
label4.setText("Employee Salary:");
text4 = new JTextField(20);

label5 = new JLabel();
label5.setText("Employee Address:");
text5 = new JTextField(20);

ADD=new JButton("Print");

panel=new JPanel(new GridLayout(6,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(label3);
panel.add(text3);
panel.add(label4);
panel.add(text4);
panel.add(label5);
panel.add(text5);
panel.add(ADD);
add(panel,BorderLayout.CENTER);
setTitle("FORM");

ADD.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String id[]={text1.getText()};
String name[]={text2.getText()};
String des[]={text3.getText()};
String sal[]={text4.getText()};
String add[]={text5.getText()};

java.util.List<String> list = new ArrayList<String>();
for(int i = 0; i < id.length; i++) {
String line = id[i]+" "+name[i]+" "+des[i]+" "+sal[i]+" "+add[i];
list.add(line);
}
writeToFile(list, "Employee.txt");
JOptionPane.showMessageDialog(null,"Inserted into File");
text1.setText(" ");
text2.setText(" ");
text3.setText(" ");
text4.setText(" ");
text5.setText(" ");

}
});
}
private static void writeToFile(java.util.List<String> list, String path) {
BufferedWriter out = null;
try {
File file = new File(path);
out = new BufferedWriter(new FileWriter(file,true));
for (String s : list) {
out.write(s);
out.newLine();
}
out.close();
} catch(IOException e) {}
}
}
class InsertToFile{
public static void main(String arg[]) {
try
{
Form frame=new Form();
frame.setSize(300,300);
frame.setVisible(true);
}
catch(Exception e)
{}
}
}

Thanks


Related Tutorials/Questions & Answers:
Create Reports in Java with access database - Java Beginners
Create Reports in Java with access database  Hello Sir How to Create Reports of Any Type using Java when i submit data is stored in the MS access database,but when I click on PRINT Button then it will display it into either Text
How to create and Attach MS Access Reports and Crystal Reorts in Java. - Java Beginners
How to create and Attach MS Access Reports and Crystal Reorts in Java.  How to create and Attach MS Access Reports and Crystal Reorts in Java WITH MS Access 2007 Database, plz Help Me Sir
Advertisements
How to Create and display Reports in Java with Database connectivity - Java Beginners
How to Create and display Reports in Java with Database connectivity  Hello Sir , I have Created Student Admission Form with Swing and MS Access 2007 Database Connection,when i will click on Print button it shows the report
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to Create any type of Reports in Java - Java Beginners
How to Create any type of Reports in Java  Hello Sir ,How I can create any type of Reports like Crystal Reports etc(Student Result Report) in Java Application,plz Help Me Sir
Reports in java - Swing AWT
How to create Reports in Java  How to create reports in java. The report should come from the access It should be displayed in the JTable and should be updated automatically when the user is saved a record in the JTable
Create Crystal reports with PHP
Create Crystal reports with PHP  I'm New to eclipse and php. I need to create a report using crystal report on php. is that possible. If it is, how could I install it to eclipse IDE. How to use
Create Crystal reports with PHP
Create Crystal reports with PHP  I'm New to eclipse and php. I need to create a report using crystal report on php. is that possible. If it is, how could I install it to eclipse IDE. How to use
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java   how to access the MS ACCESS database with java how can we insert,delete,update,search records of ms access with java   Java MS Access database connectivity Follow
creating reports in java
creating reports in java  how to create reports automatically in java and send it via mail by scheduling tine for weekly,monthly basis
how to access the MS ACCESS database with java - Java Beginners
how to access the MS ACCESS database with java  how can we insert,delete,update,search records of ms access with java
reports
reports  hi i want to create reports in my projects . plz give me some idea how to create reports in jsp
Jasper Reports - Java Beginners
/), it is free and based o JasperReports. It lets you create sophisticated reports...Jasper Reports  Hi, I'm new to Jasper Reports. Please help me by giving a simple example of Jasper report generating. Thank You, Umesh 
Problem with JRadioButton and Access Database - Java Beginners
in Access Databse, I want to store course type in to database and also other fields...Problem with JRadioButton and Access Database  Hello sir ,Here I have...(); JOptionPane.showMessageDialog(p1,"Data is successfully inserted into database."); con.close
cannot insert data into ms access database - Java Server Faces Questions
Microsoft Access Driver(*.mdb) 5. Select database name and Create the DSN name...cannot insert data into ms access database   go back   Hi Friend, You can use the following steps for creating DSN
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  Hi all my Friends I have below code which insert a picture into M.S. Access Database But i m still not able to open this picture through Java using M.S. Access
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to store JComboBox selected Item into Ms Access Database  How to store JComboBox selected Item into Ms Access Database.  Hi Friend...(); } public SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing
How to Generate Reports in Java - Java Beginners
How to Generate Reports in Java  How to Display and Generate Reports in Java? Give Me Full Sample Code  Hi Friend, What do you want to display on reports.Please elaborate it. Thanks
Connect database in Access to Netbean?
Connect database in Access to Netbean?  how to connect database in micrsoft access to Netbean?i know it can be connected by using JDBC-ODBC bridge, can i know the steps in connecting the database? Is there any source code
how to generate reports from oracle database using jsp and ajax code
how to generate reports from oracle database using jsp and ajax code  Hai masters i am new to this Java world. my team leader ask me to generate sales report data from oracle database to jsp page please any one know how to do
ACCESS DATABASE FROM HTML
ACCESS DATABASE FROM HTML  I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Access database in html page(client side
How to Store Float Value into Access Database - Java Beginners
How to Store Float Value into Access Database  Hello sir,I want to Store Student Marks Percentage into Access Database in Float Value how i can Store.... To store the double value in Access database, you need to set the datatype
Problem with Double type Value in Access Database - Java Beginners
Mobile Number with MS access Database,plz Help Me Sir.   Hi Friend...Problem with Double type Value in Access Database  Hello sir I have store Double Type Value in MS Access Databse,but when I search Record
Add Items in JComboBox from Access Database - Java Beginners
Add Items in JComboBox from Access Database  Heelo Sir I want To add ittem in JComboBox which is stored in Access Database. plz Help Me Sir Database Column name -Course Items -MBA,MCA,MBA IT,MBA FINANCE I want Load Database
How to save JCombobox Selected Item in to Access Database - Java Beginners
How to save JCombobox Selected Item in to Access Database  How to save JCombobox Selected Item in to Access Database  Hi Friend, Try... SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing"); f.getContentPane
Access 2007 database connectivity
Access 2007 database connectivity  i design an application form... source and destination. pls tell me the code of connectivity with access 2007 database using JComboBox.thanks
connecting to access database
Access Driver(*.mdb) Select database name and Create the DSN name (e.g access...connecting to access database  print("code sample");Hi I Write java... this there is no error but my data is not going to my Acess Database. There is working
how to access database in applet
how to access database in applet  HI... I'm having an applet where we should display the database values in the applet... It works fine in the local system(same network)... but when its in the server, we r getting null values
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
Applet database access - Applet
Applet database access  HI... I'm having an applet where we should display the database values in the applet... It works fine in the local system... but when its in the server, we r getting null values in the local system.. I
how to store image file and videofile in ms access database using java? - JDBC
how to store image file and videofile in ms access database using java?  how to store image file and video file in ms access database using java
JSP and Database access
JSP and Database access  Hi, Please help me with the following program. I am not able to update all the pa column values in my database. csea.jsp: <html> <body> <%@page import="java.sql.*"%> <form method
reports creation
reports creation  hi................. how to create tabular format report in java swings?????????????   Please visit the following link: http://www.roseindia.net/java/example/java/swing
Crystal Reports for Eclipse
development environment can simply embed Crystal Reports into their java... of Crystal Reports for Eclipse mark the first time that a Java version of the world's... of charge. That's right, Crystal Reports for Eclipse, will provide Java Developers
The JDBC API to access a desktop database like Microsoft Access over the network.
The JDBC API to access a desktop database like Microsoft Access over the network.  How can I use the JDBC API to access a desktop database like Microsoft Access over the network
Create a counter in mySQL 5 database through Java - SQL
Create a counter in mySQL 5 database through Java  Dear Editor, Thanks for your valuable Java code example for JFileChooser. I had another question regarding Java & mySQL 5 database
Access Report to Java Application - Java Beginners
Access Report to Java Application   Hello Sir can I connect Access Report to Java Application when i Enter Student ID in JTextField then the Appropriate Records From the Database will Be Shown in to Access Report. plz Help
Create a database
Create a database       In this section, we will teach you to create a database.  First of all... database. Then create a database using the given syntax and give the suitable name
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
Access Database  Hello Sir I want Store Corse Type that contains Two JRadioButton I want Store Information from JRadioButton to MS Access Database, and I... JFrame("Frame in Java Swing"); f.getContentPane().setLayout(null); JLabel
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
Migrating sql database to Access through coding
Migrating sql database to Access through coding  How can i migrate SQL database(table) to My access through coding
Access and Java - Java Beginners
: MS Access, A employee database using Access and SQL which keeps the records...Access and Java  A construction company has specialized in planning... the employee records in EXCESS and convert it to JAVA programing with solid and simple
Create Database SQLite
Create Database SQLite  Hi, I am unable to create database in sqlite... it on Desktop and i add the table into my project. Create Table into MSQLite Database... of all open the MSQLite database and from top menu item's choose File->New
applet connected to table in MS Access database
applet connected to table in MS Access database   i have connected my java code with the MS access database and this is my code, can anyone tell me... makeConnection(); //create a table createTable
Java access modifiers
Java access modifiers  If a class is declared without any access modifiers, where may the class be accessed
Adding a Reports tap in table pool
Adding a Reports tap in table pool  strong textHow to write a code to create a report in java using eclipse and link that report in jsp file... there and I have to include Reports tap in that table so that whne the user
How to access (MySQL)database from J2ME?
How to access (MySQL)database from J2ME?  I am new to J2ME. I am using NetBeans. Can anyone help me? How to access (MySQL)database from J2ME? ( I search a lot I found that there is need to access database through servlet
display data from a table in Access Database in a HTML page
display data from a table in Access Database in a HTML page  how to display data from a table in Access Database in a HTML page in a Java Program
how to delete the access database value in jsp
how to delete the access database value in jsp  i loaded my database data into the dropdown list box...now i want to delete the value..plz send the source code to delete the value in dropdown list box and also from database
how to delete the access database value in jsp
how to delete the access database value in jsp  i loaded my database data into the dropdown list box...now i want to delete the value..plz send the source code to delete the value in dropdown list box and also from database
 

 

 

DMCA.com