<table bord" name="description">


Home Answers Viewqa JSP-Interview-Questions search in Two Tables to Find data and view by jsp

 
 


maky
search in Two Tables to Find data and view by jsp
3 Answer(s)      a year and 3 months ago
Posted in : JSP-Interview Questions

hi i want search in Two Tables to Find data and view by jsp <%@page import="java.sql.*"%>

<table border="1">
<h2>Citizen account</h2>
<tr><td></td>

<td><b><u>Name</u></b></td>
<td><b><u>Account Number</u></b></td>
<td><b><u>Amount</u></b></td>
</tr>

<%
String acnumber =request.getParameter("acnumber");


try{
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
%>
<%
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/KDatabase","root","");
ResultSet rs = null;
Statement st=null;
%>
<%
st=conn.createStatement();
rs = st.executeQuery("select * from electricity where accountno='"+acnumber+"'");


if(rs=accountno){
int i=0; 
while(rs.next()){ 
%>

<tr>
<td> </td>
<td><%= rs.getString("name") %></td>
<td><%= rs.getString("accountno") %></td>
<td><%= rs.getString("amount") %></td>


</tr><%
i++;
}

}else st=conn.createStatement();
rs = st.executeQuery("select * from electricity where accountno='"+acnumber+"'");
int i=0; 
while(rs.next()){ 
%>
<tr>
<td> </td>
<td><%= rs.getString("name") %></td>
<td><%= rs.getString("accountno") %></td>
<td><%= rs.getString("amount") %></td>
</tr><%
i++;
}





}catch(SQLException e){ 

System.out.println(e.getMessage());
 } 

 %>

<jsp:include page="footcitilogin.jsp"/>
View Answers

February 22, 2012 at 4:52 PM


Have a look at the following link:

JSP search using two tables


February 22, 2012 at 9:04 PM


sorry my friend this is another issue, I want like

if found in first table print the row else go to second table.

rs = st.executeQuery("select * from electricity where accountno='"+acnumber+"'");
if(rs != null){              // If find it print("you paid")  If not go next step
out.println("you paid"+ rs);



}else if(rs == null) {      // here must print ("you must paying bill")
rs = st.executeQuery("select * from paying where accountno='"+acnumber+"'");
out.println(" you must pay  ");
}

February 23, 2012 at 7:25 AM


i want to write payment bill code (create two table the first table: the bills for user the admin insert in this table the second table: when the user pay insert in this table he has paid )

1-the user write account number and submit 2-the process search in the second table if he has paid give him message you have paid if not found it then search in the second table it must be there and view the bill for the user









Related Pages:
search in Two Tables to Find data and view by jsp
search in Two Tables to Find data and view by jsp  hi i want search in Two Tables to Find data and view by jsp <%@page import...; Have a look at the following link: JSP search using two tables   
How to send and view data in seperate tables of a swing application, to a japser reporting(two)
How to send and view data in seperate tables of a swing application, to a japser reporting(two)  I have 2 tables in one swing user interface. I want... want to know do for two tables. (here I am sending two parameters as well
How to send and view data in seperate tables of a swing application, to a japser reporting(two)
How to send and view data in seperate tables of a swing application, to a japser reporting(two)  I have 2 tables in one swing user interface. I want... want to know do for two tables. (here I am sending two parameters as well
view
view  hi iam writing some struts application by using dyanafalidator form in place of actionform bean classes i can enter data by using some jsp... is i can give some validations to what ever data i can enter through jsp form i
sql query to get data from two tables
sql query to get data from two tables  how can i get the data from two different tables?   Hi Friend, Please visit the following link: JOIN Query Simple Query Thanks
Search data from database - Java Beginners
Search data from database  Hi Deepak, This is not correct code... with two button search and delete. 2:- User input name(with alphabetical searching)in name text box than all data should be displayed in another page related
Joins tables in jsp
Joins tables in jsp       When we want to select data from two or more tables.... In this example we have two tables stu_info and stu_marks. Structure of these tables
View jsp
View jsp  <%@ page language="java" contentType="text/html; charset...; charset=ISO-8859-1"> <title>View ur Details</title> </head>...;%=request.getContextPath()%>/Controller"> <input type="hidden" name="page" value="view
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name,phno second table having field: seat-id But the data is not retrieved:why so
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name,phno second table having field: seat-id But the data is not retrieved:why so
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... for retrieving data fromm two tables : first table having fields: bookid,name,phno second table having field: seat-id But the data is not retrieved:why so
how to do two database tables in one page?
how to do two database tables in one page?  dear all: i want to show these two database tables in one page. one table on the left (dbtable.jsp..." value="Search"> </form> </html> ***dbtable.jsp
What is View?
), except for the fact that the real tables store data, while the views don?t. The view?s data is generated dynamically when the view is referenced. A view references one or more existing database tables or other views. In effect every view
Simple Table View With Next View
you will find two .h and .m file SimpleTableAppDelegate.h...Simple Table View With Next View In this iphone tutorial will learn how to use Table View and also how to add object to table view, to insert the object
Join the two tables in sql
Join the two tables in sql  How to join the two tables in SQL ..and return the value from common column in SQL Database
what is the jsp coding to insert a data in database tables
what is the jsp coding to insert a data in database tables  Dear Sir, I Want to know the coding for insert the data from jsp to oracle database.. my...:8080/examples/jsp/1/insert.jsp"> <table> <tr><td>
How to compare two tables, and insert values which r not in one table to another table?
How to compare two tables, and insert values which r not in one table to another table?  Hi I need to compare two tables MainTable and OUTTable, The maintable may not have all the data so...if outtable have new data just
add same tables in jsp page
add same tables in jsp page  hi I have a table in my jsp page with data, now I want to add same copy of table without its default value in same page whenever I click add more table, how do I do
displaying data based on criteria from 2 tables having same type of data - Java Beginners
displaying data based on criteria from 2 tables having same type of data ... to process search criteria without having a form. I have recently read up about...) to process a search. The search will have following features:- 1
how to add the two tables in same row when generating pdf file from jsp - JSP-Servlet
how to add the two tables in same row when generating pdf file from jsp  How to add the two tables in same row one is left side and other is right side please help me.   Hi Friend, Try the following code
types of relationships in tables
are implemented by splitting the data into two tables with primary key and foreign...-to-many and many-to-many relationships while designing tables?   hi, One-to-One relationship can be implemented as a single table and rarely as two
JSP tree view - JSP-Servlet
JSP tree view  Hi... In my project i need to display the data from database in the form of tree structure... i.e. like horizontal binary tree I've to dynamically get the values... Can you plssssss suggest me how
search
search  how to develop search box and how to retrive data from database..   Please visit the following link: Search box
Code for search data - Development process
Code for search data  Hi, can u give me jsp code for search data. When i select any 1 from 3, it has to display all d corresponding data from database sub-combo box in this code is not working. Search Page
SEARCH PAGE
SEARCH PAGE  search page:option for search criteria like name and DOB will be asked.on entering the detail,data matching search criteria... for this using jsp...?   Please visit the following links: http
Subtitle in Table View  iPhone
the object into the Table View, how to add search bar to Table view and many more... or to add object into the Table view we have to create an array variable, for two... for the data which we have to enter into Table View. Add
SEARCH
SEARCH  how can we do search in jsp...? option for search criteria like name and DOB...   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
JSP Search Example code
JSP Search - Search Book Example   ... are going to develop a small sample JSP search application that searches the data from database. In this example we will search the book from database
how to display data from database according to entered value in search field
how to display data from database according to entered value in search... :)   Here is a simple JSP search application where user is allowed to enter...://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="sql" uri="http://java.sun.com
Table view with multiple view and sections
to the cell(Rows of Table View)  and will have two section in Table View... to enter the data on table view we have to take an array and using that will add... Table view with multiple view and sections Project will look like
I need to join three tables and return data that may not be in all three tables
I need to join three tables and return data that may not be in all three tables  How do I join three tables and return information even if it is in only two of the tables   Hi Friend, Please visit the following link
view jsp file (reference file). is the way of coding good ?
view jsp file (reference file). is the way of coding good ?  <...;The given code retrieves the data from the database and display it in html tables...="ISO-8859-1"%> View Retailer <%@ page import="com.tcs.ilp.*" %>
Cross Join Tables in a Specific Database
join between two tables. The cross join operation retrieves data between two... and outer join operation. The cross join is used to retrieve data from tables... will be performed between two tables. Both tables hold some specific fields
How to find out the friend user between two columns in sql database
How to find out the friend user between two columns in sql database  Hi, Can any one please tell me ..how to find out the friend user between two columns in sql database? In other words i wanted to get the corresponding data from
how to get data using dropdownlist, textbox and search button in jsp
how to get data using dropdownlist, textbox and search button in jsp  Hi, I want to display data using jsp,javascript and mysql. My Q. is If i select...' in textbox and click on search button it should show me all the title names
SQL Create View
  A view shows updated records. The database recreate the data using... SQL Create View       A View is a imaginary and virtual table in SQL. In SQL, a view
JSP view detail page on accept button click
JSP view detail page on accept button click  i Have 1 jsp page in that there r 2 button accept and view details when we click on aceept button it will submit to next page and when click on view details page it will shown the data
Mysql Alter View
not contain data. The view is the outcome result set of a SELECT statement. A view include  rows and columns from one or more than one tables. A View is ... (0.02 sec) Query to view data of  Table named employees: To view
Join tables in the specific database
two or more tables in a specific database. For this you need to have two or more table in the database. If two or more tables are available in the database... records between two or more tables. It relates one table to another. Joining
JSP hide and show tables
JSP hide and show tables In this tutorial, you will learn how to hide and show html tables using javascript in jsp. Here is an example of simple jsp code which is having a table consists of database data and a Go button. Using
Selecting particular data from multiple tables at database and perfoming calculations
Selecting particular data from multiple tables at database and perfoming... users for 1 year and update the details in jsp page.. so i have decided... the output based on month) .. I have created 12 tables with table name
Push View Controller - Example
In this pushViewController example, you'll find the way to make transition between two views. In Cocoa, we have several instance methods which is used... from the stack. The UIViewController automatically adjust the size of next view
CSV tables
CSV tables  hello, What are CSV tables?   hii, CSV Tables cannot be indexed.CSV Tables are the special tables, data for which is saved into comma-separated values files
Search bar application
Search bar application In this tutorial, will be creating a Search screen, which have a table view with a search bar. Table should display all the data if search field is empty other wise it should show all the data which matches
SQL Server row comparison using two tables
SQL Server row comparison using two tables  insertion process are completed in table1.string comparison using table2 to table1 if any changes in these tables and then upadated
Model View Architecture - JSP-Interview Questions
rules used to manipulate the data, the view corresponds to elements of the user...Model View Architecture  Describe the architectural overview of Model view architecture?  Hi friend, Model-view-controller (MVC
Comparing tables
Comparing tables  How to compare two or more tables in the Mysql database using jdbc
sql query search function
sql query search function  i have a textbox on a form , i like a search a data in the form, when i give whatever name and id or etc..its will search and show the same form , so help me using jsp
Can not find "org.apache.poi " - JSP-Servlet
Can not find "org.apache.poi "  Hi friend, Thanks for giving me a solution.Thanks a lot.I have executed the program but it is showing an error message that "org.apache.poi " can not be resolved. I have search it form
Mysql Join 3 Tables
'); Query OK, 1 row affected (0.03 sec) Query to view data of  Table...','Amit@gmail.com'); Query OK, 1 row affected (0.01 sec) Query to view data... to view data of  Table named employee:- mysql> select * from employee

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.