<table bord" name="description">

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="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 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:ADS_TO_REPLACE_1 JOIN Query Simple Query ThanksADS_TO_REPLACE_2
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 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
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... = window.adsbygoogle || []).push({}); But the data is not retrieved:why so??? 1)first -.java
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... = window.adsbygoogle || []).push({}); But the data is not retrieved:why so??? 1)first -.java
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... = window.adsbygoogle || []).push({}); But the data is not retrieved:why so??? 1)first -.java
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 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 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
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
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... id: <input type="text" name="id"> <input type="submit" value="Search
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
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
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
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
ModuleNotFoundError: No module named 'django-data-tables'
ModuleNotFoundError: No module named 'django-data-tables'  Hi, My... named 'django-data-tables' How to remove the ModuleNotFoundError: No module named 'django-data-tables' error? Thanks   Hi, In your
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
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
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
find data science jobs
find data science jobs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: find data... the topic "find data science jobs". Also tell me which is the good
ModuleNotFoundError: No module named 'data-view'
ModuleNotFoundError: No module named 'data-view'  Hi, My Python... 'data-view' How to remove the ModuleNotFoundError: No module named 'data... have to install padas library. You can install data-view python with following
ModuleNotFoundError: No module named 'data-view'
ModuleNotFoundError: No module named 'data-view'  Hi, My Python... 'data-view' How to remove the ModuleNotFoundError: No module named 'data... have to install padas library. You can install data-view python with following
ModuleNotFoundError: No module named 'data-view'
ModuleNotFoundError: No module named 'data-view'  Hi, My Python... 'data-view' How to remove the ModuleNotFoundError: No module named 'data... have to install padas library. You can install data-view python with following
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
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 (adsbygoogle = window.adsbygoogle || []).push({}); http://www.roseindia.net
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 (adsbygoogle = window.adsbygoogle || []).push({}); http
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 (adsbygoogle = window.adsbygoogle || []).push({}); http://www.roseindia.net
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... operation will be performed between two tables. Both tables hold some specific
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
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 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
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
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
JSP Elements
JSP Elements       A JSP page can have two types of data: Template Data: It is the static part... by the JSP server is known as template data. JSP Elements: It is the dynamic
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
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
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
PHP search data with different format
PHP search data with different format  How to search data with different format in PHP
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

Ads