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

 
 


sushant
Create Reports in Java with access database
1 Answer(s)      3 years and 2 months 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
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 Pages:
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
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
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
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
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
reports
reports  hi i want to create reports in my projects . plz give me some idea how to create reports in jsp
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
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
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
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
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 
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
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
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
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
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
JDBC : Create Database Example
JDBC : Create Database Example In this section you will learn how to create database using JDBC with example. Create Database : Database is an organized...: MySQL, Ms-Access, Oracle etc and java files. The SQL statements are executed
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
JDBC access database
JDBC access database       JDBC is a Java Database Connectivity. The JDBC Connectivity provides API classes and interfaces for connecting the front end in Java application with database connections
Select Employee and display data from access database in a jtable
Select Employee and display data from access database in a jtable  I there Iam a java beginner. I have to create a application where I can select... name of the customer is stored in a access database. Below is how it should
How to create a jar file with database connection
How to create a jar file with database connection  Hello Everyone!!! Pls Help me in this... i have a program which has a database connection with ms access & i want to create a jar file of it... I have tried with manifest
Reports to pdf conversion
Reports to pdf conversion  I need to convert reports into pdf format using java.. Will i get any sample code
Crystal clear reports
Crystal clear reports  what is crystal clear and i-text reports in java? plz give me full information
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
Data Access Object
Creating Data Access Object (DAO) Design Pattern The Data Access Object is a design pattern, which consists java classes and methods to access the data... data from database. Hibernate contains java some classes and .xml files
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
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access... language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database Follow...-> data sources. 2)Click Add button and select the driver Microsoft Access... language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access... language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding
java to MS Access conectivity - Swing AWT
java to MS Access conectivity  give me source code to stored... database on the ACCESS.  Hi Friend, Follow these steps: 1. Open...(*.mdb) 5. Select database name and Create the DSN name (e.g emp) 6. Click "Ok
database
database  I wanted to know if it is possible to establish database connection on a remote pc with mysql using java swings from netbeans and then create a database on the remote pc.... Kindly help me
database
database  Im doing my project in java swings...netbeans I wanted java source code to establish connection to postgresql_8.1 using jdbc and create a user defined database and a table in that database and insert values Plz help me
database
give the name of the database name that he want to create in a textfield... database..im doing my project in java swings.....netbeans Kindly help me ThankYou...database  I want to let the user select one of the database type
Crystal Reports with Spring: problem
Crystal Reports with Spring: problem  Hi all, having successfully used the Crystal Reports' API - JRC version 11.8.4.1094 - in a Java environment with: 1)JBoss 4.2.3, 2)Oracle 11, 3)EJB 2, 4)Crystal Reports 2008 as reporting
jfreechart displaying chart from access database
jfreechart displaying chart from access database  I have these 2 codes. array.java----in which i retrieve the values from the database . import... javax.servlet.http.HttpServletResponse; /** * * @author AARUSHI */ class database { int roll; String
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
database
of combo box in java - from database? you had given me the answer <%@page...database  How can i get combo box values from database?? or how... u give me the code in microsoft access of this program. and also can u tell me
Access all the fields from table through JSP
Access all the fields from table through JSP       This is detailed java program to connect java application with MySql database and execute query to display
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
Jasper Reports - Development process
Jasper Reports  I can't find any Jasper report tutorial in this site. Can any one one provide me the code on how to use jasper report in net beans ide and how to develop a report by connecting to database
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
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
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 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
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