Extracting table from Access Database to Servlet

Extracting table from Access Database to Servlet

Sir, I have a table with 4 field deptid, headid, normalexpend and projectexpend. Now I have to display a consolidated data where sum of normal_expend under particular head for all depts need to be displayed. For ex. dept d1 has spend 400 under head h1. dept d2 has spend 500 under h1. So the output under Head h1 on result page should show 900. I have written the query as : Select sum(h1) from expend where head_id="h1". The problem is that I have 20 heads and 10 depts which means I'll have to write this query around 30 times.

'Statement stat=con.createStatement(); ResultSet res=stat.executeQuery("select SUM(ne) from expenditure1 where headid=H1"); while(res.next()) { A_n = res.getInt(1); }'

I'm querying the data like this so does this mean i have to write the set of statements given above for all 20 heads. What is the correct method of doing this please somebody explain me.

View Answers









Related Tutorials/Questions & Answers:
Extracting table from Access Database to Servlet
Extracting table from Access Database to Servlet  Sir, I have a table with 4 field deptid, headid, normalexpend and projectexpend. Now I have... show 900. I have written the query as : Select sum(h1) from expend where head_id
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
Advertisements
how to display a table from database using servlet
how to display a table from database using servlet  how to display a table with values from servletpage   Hi Friend, Please go through the following link:ADS_TO_REPLACE_1 http://roseindia.net/jsp/servlet-jsp-data
to get picture from ms access database by jsp-servlet....
to get picture from ms access database by jsp-servlet....  I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp
Retrieve database from the table dynamically in jsp from oracle using servlet
Retrieve database from the table dynamically in jsp from oracle using servlet  Sir, I have created a table in oracle using eclipse, and added few... using java servlet from the database in the jsp page
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
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
use data from database table as hyperlink value - JSP-Servlet
use data from database table as hyperlink value  I'm creating a web page that allows user to search my database. The page will display partial results of my database, then the first column of the resultset was converted
How to access the database from JSP?
How to access the database from JSP?  Hi, What is the process of accessing the database from JSP page? Thanks   Hi, In the JSP program... database from JSP which explains you how to access the database by embedding
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
Upload csv or .xlsx file from JSP form to Database Table using servlet
Upload csv or .xlsx file from JSP form to Database Table using servlet  dear sir, i need the Servlet code that reads the .xlsx or CSV excel file and stores it into the oracle database table. Sir Its very Urgent I have
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
how i conditional access the data from database using combo box. - JSP-Servlet
how i conditional access the data from database using combo box.   i... access the data from database when i select class 11 0r 12. Here is JSP file...="+cla+"&&from_year="+y1+"&&to_year="+y2+"&&school="+sch); alert(sch+" "+cla+ " "+y1
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...()); } } //retrieve data from table COFFEES static void retrieveData() { try
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
jfreechart display from access database data.
jfreechart display from access database data.  I have made a database... to retrieve the data from the access database using prepared statement and then display... is to be done in a servlet.. Note that it is a access made database. How can I
Retrieve image from database using Servlet
Retrieve image from database using Servlet     ... that connects to the MySQL database and retrieves the image from the table. After... applications that retrieves the image from database. You can use this type
how to use String tokenizer on table that is retrieved from database using jsp servlet
how to use String tokenizer on table that is retrieved from database using jsp servlet  Query:Table---- mysql> select pid,medicinename,dose,day,qty from medicinedetails2 where pid=15
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
Retrieving the Image from a database Table
Retrieving the Image from a database Table Consider a case where we want... to retrieve the image from the database table. You can do it very easily after... from the database table our java program need to make a connection
Extracting variable from jsp
Extracting variable from jsp  how to Write a java program which will be extracting the variables and putting them in an excel format?   The given code allow the user to enter some fields and using the POI API
retreiving data from microsoft access database
retreiving data from microsoft access database  How can i retrieve data from microsoft access when i have select the vaules in combo box and text box. When i select these values... i want to retrieve the corresponding columns
Access all the fields from table through JSP
Access all the fields from table through JSP...;Data from the table 'stu_info' of database 'student'</h2> <% try... data from the specified table. Before running this java code you need
Deleting a Table from Database
Deleting a Table from Database   .... In this section we are describing, how to delete a table from database using java methods. Java provides the facility for deleting a specific table from a given database
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able... database i have attributes pH, phosphate, ....... month, year......... so its
How to retrieve image from database in Servlet?
How to retrieve image from database in Servlet?  Hi, How to retrieve image from database in Servlet? Thanks   Hi, Please check the tutorial Retrieve image from database using Servlet. Thanks
Delete a Column from a Database Table
Delete a Column from a Database Table   ... to delete a column from a database table. We are not going to create a new table... a column from a database table then we have been provided with the  database
Fetch user records from a table in database
Fetch user records from a table in database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI  Hello... that involves inserting a record into a 6-column table in my MS Access database table. I'm..._UPDATABLE); String sql = "select * from DonorTable"; rs
Upload Excel into Database Table Using SERVLET - JSP-Servlet
Upload Excel into Database Table Using SERVLET  Hi i hava sitution that upload .xls file into database table which has same coloumn names... in database table are NAME,ID,SAL. please help me to upload that excel using
Extracting equation from any document
Extracting equation from any document  how can i extract equation from any word document?   Hello Friend, If you want to extract data from the word file, then visit the following link: Extract data from word document
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want to maintain the financial database of 20 users for 1 year and update the details... created 12 tables with table name - month1,month2,....,upto month12.. each table
Deleting All Rows From the database Table
From the database Table      ... helps us to write on the browser. To delete all the rows from our database table... the PreparedStatement object. If the rows has been deleted from the database table
unable to display table data on JSP page that is coming from mysql and servlet.
unable to display table data on JSP page that is coming from mysql and servlet.  I am unable to show table data on JSP page using servlet and mysql. only two rows data i showing but in my database I have five fields
unable to display table data on JSP page that is coming from mysql and servlet.
unable to display table data on JSP page that is coming from mysql and servlet.  I am unable to show table data on JSP page using servlet and mysql. only two rows data i showing but in my database I have five fields
unable to display table data on JSP page that is coming from mysql and servlet.
unable to display table data on JSP page that is coming from mysql and servlet.  I am unable to show table data on JSP page using servlet and mysql. only two rows data i showing but in my database I have five fields
How to delete the row from the Database by using servlet
then the user data to be delete from the database table. Assume in Database table have...: Delete row from database using servlet   In that link solution... details (HTML Page, Database table, Servlet Program) see this link link text
retriving image from database - JSP-Servlet
retriving image from database  how to retrive image from mysql database by using servlet programming  Hi Friend, Please visit the following link: http://www.roseindia.net/servlets/retreiveimage.shtml Thanks
Select data from Table in Database
Select data from Table in Database   ... the selected data from table in database. The select query in the database retrieve...; in simple select statement is given below select column name from table;ADS
Select Employee and display data from access database in a jtable
Select Employee and display data from access database in a jtable  I... name of the customer is stored in a access database. Below is how it should... a employee's name from a comboBox and the jtable will be filled with all
Updating Ms Access Database using jsp - JSP-Servlet
Updating Ms Access Database using jsp  Hi I am new to jsp and I am trying to update a record in an access database. I only want to update part... a table product(prod_id,prod_name,quantity,price) and try the following code
Fetching database field from servlet to jsp page ?
Fetching database field from servlet to jsp page ?  Hello Java... field. I wanted to pass some of the database field from servlet to jsp... (i am opening my database in servlet init() method ) how to pass rs.getString(8
getting values from database - JSP-Servlet
getting values from database  I tried the following code abc.html... JSP code separately.If it will not display database values then try your code in Servlet. Thanks
How to retrive database information using servlet and disply in table format in browser
How to retrive database information using servlet and disply in table format in browser  Hi, any one send code how to retrive the data base information in table format in web browser
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
Deleting All Rows from a Database Table
Deleting All Rows from a Database Table   ... database table, now we have to delete all the rows from the table. This section describes for deleting all rows from a specific database table. Deleting all rows
Deleting Blob Data from Database table using servlet
Deleting Blob Data from Database table using servlet In this section, we will discuss about how to insert a blob data into a database table. A Blob stores a binary large object in the database table's row. Blob object
How to search the table name in MS SQL Database 2005 from application
How to search the table name in MS SQL Database 2005 from application  How to search the table name in MS SQL Database 2005 from application from our helpdesk application? application might be in html
Spring Security Authorized Access with Customized Login from Database
Spring Security Authorized Access with Customized Login from Database In this section, you will learn about authorized access with customized login from... stored in database table. For Spring Security authorized access using auto

Ads