<table bord" name="description">
Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


maky
search in Two Tables to Find data and view by jsp
3 Answer(s)      2 years and 5 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"/>

Advertisement
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 Tutorials/Questions & Answers:
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
Advertisements
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
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
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 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 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
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
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
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
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
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
Purge Data from Mysql tables
Purge Data from Mysql tables  Hi, i have to write a mysql procedure to purge data from tables. but written procedure clear entire tables data. Please give me the solution for purging data. CREATE DEFINER=`root`@`localhost
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
can i insert values into two tables by a query - JDBC
can i insert values into two tables by a query  hi all, can i insert values into two tables by a query Thanks Bala k
Combine Two Tables(Purchase and Sales) and getting Current Stock
Combine Two Tables(Purchase and Sales) and getting Current Stock  How can i combine both the Tables and Getting Current Stock
PHP search data with different format
PHP search data with different format  How to search data with different format in PHP
Natural Join / joining two tables
Natural Join / joining two tables  A join provide the facility to merge two tables according to common field and Create a new virtual field. We...");  try{   Statement st = con.createStatement();         //Join two tables
view data from jTextArea to jtable
view data from jTextArea to jtable  good night Please help senior java all, I want to make a brief program of reading data in the text area and then on the show to the j table. I created a new scrip like below but it does
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
To find first two maximum numbers in an array
To find first two maximum numbers in an array  Java program to find first two maximum numbers in an array,using single loop without sorting array
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
how to store array values into two different tables in java?
how to store array values into two different tables in java?  I have... and now I want to store these values in two different tables(i.e store 2 array values in one table and remaining two values in another table
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
Data fetch from multiple SQL tables - Hibernate
multiple tables using left and right outer joins. I need to convert this JDBC data... that would use table classes to retrieve data from 8 or 9 tables. Any example of HQL fetching data from multiple tables would be a help. I have tried
Search Page in jsp
Search Page in jsp  search page in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
search form in jsp
search form in jsp  search page in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
Search page form in jsp
Search page form in jsp  search form in jsp   Please go through the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
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
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
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
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
Lucene Search in JSP - JSP-Servlet
Lucene Search in JSP  Hello Sir, I want to Develop lucene - Search engine in Jsp page which can Search full text from XML file..through XML parser.. Example: in Search interface there are one textbox after putting some value
JSP search engine - JSP-Servlet
JSP search engine  Hi! In my project i have a concept of search engine which has to search in google and display the results in my page. My PM told me use GOOGLE API for search engine. I am developing applicatin in JSP. Can
Find L.C.M. of two numbers in Java
Find L.C.M. of two numbers in Java Program In this section, you will learn how to find LCM(Least Common Element) of two integers.The least common multiple... have created a method determineLCM(int a, int b) where we have compared the two
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
Alert View with two Buttons
Alert View with two Buttons Project will look like this :     In this tutorial we are going to show alert view, this is shown... is UIAlertView,is based on View application so it will have two .h and two .m file i.e.
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
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
search feature - JSP-Servlet
search feature  i need help to do a search feature servlet to search for employees from the database. the search will be done by search by employee name, department and email  Hi friend, As per your problem
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
how to get values for same column name from two different tables in SQL
how to get values for same column name from two different tables in SQL  how to get values for same column name from two different tables in SQL???? column name is emp_id loacated in these two tables company,employee
 

 

 

DMCA.com