Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions retrieve from database........

Have Programming Question? Ask it here!
 
 
 


indrajeet kamble
retrieve from database........
3 Answer(s)      3 years and a month ago
Posted in : JavaScript Questions


<p>hi i am not able to retrieve string from database to a text box in web page my code is as follows:-</p>

<p>&lt;HTML>
<link rel="stylesheet" type="text/css" href="format.css" >
&lt;HEAD>
&lt;TITLE>Modify Profile </TITLE>
</HEAD></p>

<p>&lt;%@ include file="connect.jsp"%>
&lt;%
int aa,ab,ac,ad,ae,ag;</p>

<p>String ia="0",ib="0",ic="0",id="0",ie="0",ig="0";
try{
String username=request.getParameter("username");
re=stmt.executeQuery("select * from userreg where username='"+username+"' ");
while(re.next())
{
ia=re.getString("name");
ib=re.getString("surname");
ic=re.getString("dob");
id=re.getString("email");
ie=re.getString("hintques");
ig=re.getString("hintans");
}
aa=Integer.parseInt(ia);
aa=aa;
ab=Integer.parseInt(ib);
ab=ab;
ac=Integer.parseInt(ic);
ac=ac;
ad=Integer.parseInt(id);
ad=ad;
ae=Integer.parseInt(ie);
ae=ae;
ag=Integer.parseInt(ig);
ag=ag;</p>

<p>%>  </p>

<p>&lt;BODY></p>

<div id="header">
<p align="center"> <font face="Times New Roman, Times, serif"  size="15"> <b><u>PASSPORT SERVICE</u></b></font></p>
<p align="center"> <font face="Times New Roman, Times, serif"  size="4"> <b>REPUBLIC OF INDIA</b></font></p>
</div>

<div id="nav">
<center>
<pre><font face="Times New Roman, Times, serif" size="3"><a href="index.html"><font color="#000066">HOME</font></a>    <a href="login.html"><font color="#000066">LOGIN</font></a>    <a href="process.html"><font color="#000066">PASSPORT PROCESS</font></a>    <a href="cont.html"><font color="#000066">CONTACT</font></a>    <a href="help.html" ><font color="#000066">HELP</font></a>    <a href="adminlog.html" ><font color="#000066">ADMIN LOGIN</font></a></font></pre>
</center>
</div>

<div id="nav1">
<p align="center"> <font face="Times New Roman, Times, serif"  size="5" color="#000066"> <b><u>SERVICES</u></b></font><br><br><br>
<font face="Times New Roman, Times, serif"  size="4">
<a href="fpptstep1.html"><font color="#000066">FRESH/REISSUE OF PASSPORT</font></a><br><br>
<a href=""><font color="#000066">VIEW APPOINTMENT AVAILABLITY</font></a><br><br> 
<a href="locatepsk.html"><font color="#000066">LOCATE PASSPORT OFFICE</font></a><br><br> 
<a href=""><font color="#000066">DOCUMENTS REQUIRED</font></a><br><br>
<a href="feecalcu.html"><font color="#000066">FEE CALCULATOR</font></a><br><br>
<a href=""><font color="#000066">FEEDBACK</font></a><br><br>
<a href=""><font color="#000066">FAQ's</font></a>
</font>
</p>
</div>

<form action="modifypro.jsp" method="get" method="post">
<div id="content">
<br><img align="right"  src="ts.jpg"  height="230" width="150" >
<pre>
<font face="Georgia, Times New Roman, Times, serif">
<h2><b>                  <u>MODIFY PROFILE</u></b></h2>

<table cellspacing="15">
<tr><td>Username*:</td><td><input type="text" name="username" value=""></td></tr>
<tr><td>Given Name*:</td><td><input type="text" name="name" value="<%=aa%>"></td></tr>
<tr><td>Surname:</td><td><input type="text" name="surname" value="<%=ab%>"></td></tr>
<tr><td>Date of Birth:</td><td><input type="date" name="dob" value="<%=ac%>"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" value="<%=ad%>"></td></tr>
<tr><td>Hint Question:</td><td><select name="st" value="<%=ae%>" > <option>--select--</option><option>Birth Place</option><option>Fav Color</option><option>Fav Cricketer</option><option>Fav Food</option><option>First School</option><option>Fav Food</option><option>Make Of First Car Owened</option><option>Make Of First Bike Owened</option> </select></td></tr>
<tr><td>Hint Answer*:</td><td><input type="text" name="hint ans" value="<%=ag%>"></td></tr>
</table>                      
                <input type="Button" name="b1" value="submit" >     <input type="Button" name="b1" value="Modify" onClick="val(form)" ",">     <input type="reset" name="b2" value="Clear">
</p>
</font>
</pre>
</div>
</form>

<div id="footer">
<center> © Copyright and Design by: Chandan and Indrajeet </center>
</div>

<p></BODY>
&lt;%}
catch(Exception e)
{ <br />
out.println(e);</p>

<p>}%></p>

<p></HTML></p>

Advertisement
View Answers

March 15, 2011 at 12:14 PM


1)application.jsp:

<%@ page import="java.sql.*" %>
<html>
<head>
<script language="javascript">
function editRecord(id){
    var f=document.form;
    f.method="post";
    f.action='edit.jsp?id='+id;
    f.submit();
}
</script>
</head>
<body>

<br><br>
<form method="post" name="form">
<table border="1">
<tr><th>Name</th><th>Address</th><th>Contact No</th><th>Email</th></tr>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "test";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";

int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from employee";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
while(rs.next()){
%>
<tr><td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getString(5)%></td>
<td><input type="button" name="edit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick="editRecord(<%=rs.getString(1)%>);" ></td>
</tr>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
</table>
</form>
</body>
</html>

2)edit.jsp:

<%@page language="java"%>
<%@page import="java.sql.*"%>
<form method="post" action="update.jsp">
<table border="1">
<tr><th>Name</th><th>Address</th><th>Contact No</th><th>Email</th></tr>
<%
String id=request.getParameter("id");
int no=Integer.parseInt(id);
int sumcount=0;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
String query = "select * from employee where id='"+no+"'";
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
while(rs.next()){
%>
<tr>
<td><input type="text" name="name" value="<%=rs.getString("name")%>"></td>
<td><input type="text" name="address" value="<%=rs.getString("address")%>"></td>
<td><input type="text" name="contact" value="<%=rs.getInt("contactNo")%>"></td>
<td><input type="text" name="email" value="<%=rs.getString("email")%>"></td>
<td><input type="hidden" name="id" value="<%=rs.getString(1)%>"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Update" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
</tr>
<%
}
}
catch(Exception e){}
%>
</table>
</form>


March 15, 2011 at 12:14 PM


continue..

3)update.jsp:

<%@page import="java.sql.*"%>
<%
String ide=request.getParameter("id");
int num=Integer.parseInt(ide);
String name=request.getParameter("name");
String address=request.getParameter("address");
int contact=Integer.parseInt(request.getParameter("contact"));
String email=request.getParameter("email");
try{
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root");
Statement st=null;
st=conn.createStatement();
st.executeUpdate("update employee set name='"+name+"',address='"+address+"',contactNo="+contact+",email='"+email+"' where id='"+num+"'");
response.sendRedirect("/examples/jsp/application.jsp");
}
catch(Exception e){
System.out.println(e);
}
%>


March 15, 2011 at 11:25 PM


thank u its working............thank u very much....



Related Tutorials/Questions & Answers:
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
Advertisements
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
retrieve from database........
retrieve from database........  <p>hi i am not able to retrieve string from database to a text box in web page my code is as follows:-</p>...("username"); re=stmt.executeQuery("select * from userreg where username='"+username
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
How to retrieve image from database
How to retrieve image from database  hi........ How to retrieve image from database when it is stored. I have stored image in postgresql and want to retrieve in java form. Can u tel me hw to do? I am trying n able to do also
retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink... have values C C++ i have to retrieve and if i click C its sub categories should
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list... from the dropdown, related data will get displayed on the textboxes. Here we have
how to use bean to retrieve data from database
how to use bean to retrieve data from database  how to use bean to retrieve data from database   poda sendru
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 to.... i am only able to retrieve one value not more than that. means in my
retrieve data from database using jsf
retrieve data from database using jsf  Hello I want an example of source code to retrieve data from database i have a database (oracle) name as db1...),, name ,and city I want after enter value in textbox according idauthor i retrieve
Retrieve values from database using views
Retrieve values from database using views  hi......... I have a huge database so i have created views in database where i am selecting only the columns which are required. As my front end is java swings i want to retrieve data
Retrieve value of radio button from database to form
Retrieve value of radio button from database to form  var gn=document.getElementsByName("empg"); //empg is name of radio input type. for(var i=0;i
Retrieve date from MYSQL database
Retrieve date from MYSQL database In this tutorial, you will learn how to retrieve date from database. Storing and Retrieving dates from the database... the SQL statement to the database. Here, we are going to retrieve the date
Dropdown code to retrieve result from oracle database
that will retrieve values from the database into dropdown. As the user choose any option...Dropdown code to retrieve result from oracle database  Hi Friends, I... retrieve the result from Oracle database.We have procedures created already.Just
how to store and retrieve image from database
how to store and retrieve image from database  how to store and retrieve images into database(oracle) and how to retrive images from database using jsp   Here is a jsp code that insert and retrieve image from mysql
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... that retrieve the integer values from the database and stored in the integer variables. In addition to it, we have added numbers that are retrieved from
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database...(); ResultSet rs=st.executeQuery("select * from data where id=1"); while
how to retrieve images from database to jsp?
how to retrieve images from database to jsp?  Hi sir,i want to stores images along with the name and price with database and retrieve it on jsp.and...=con.createStatement(); String strQuery = "select * from data"; ResultSet rs
how we retrieve image from database
how we retrieve image from database  my code is:- $search=$_POST... from mysql database: <?php mysql_connect("localhost","username","password... not connect to Database"); $query = "SELECT content,size,type FROM upload WHERE id=1
how to store and retrieve images int and from the database using php
how to store and retrieve images int and from the database using php  please anyone can help me in storing the images and retrieve it back from the Mysql database using php
<img src=""> using retrieve image from database using jsp
using retrieve image from database using jsp  how to <img src="" > tag using retrieve image from database and display in jsp
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
retrieve value from database on the basis of maximum id number
retrieve value from database on the basis of maximum id number  hi, i want to retrieve value of maximum id number from the database and show that value in jTextField.when the user clicks on the button that maximum id number
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking... getting data into textarea from database table by clicking on the button
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
To retrieve image from SQL Server Database - Java Server Faces Questions
To retrieve image from SQL Server Database  Sir/Madam, I am trying to retrieve image from SQL Server 2000 database in Visual Web JSF Page using... or in Image Component. please help me in retrieving and displaying image from SQL Server
Retrieve image from mysql database through jsp
Retrieve image from mysql database through jsp... to retrieve image from mysql database through jsp code. First create a database... will be retrieved from database on the basis of  'id' field of the table. So code
Retrieve data from the database and write into ppt file
Java Retrieve data from the database & write into ppt file In this section, we are going to retrieve data from the database and write into the .ppt file... of setText() method, we have inserted database values into it. Here is the code
Retrieve Data from the database and write into excel file
Retrieve Data from the database and write into excel file. In this section, we are going to retrieve data from the database and write into the excel file..., we have inserted the database table values in the excel sheet. Here
how to retrieve data into combo from database in java applet?
how to retrieve data into combo from database in java applet?  hi,. i have written applet codes for linking two frames and database connectivity but the problem is, the database is not retrieving data into the combo..please
how to send and retrieve image along with text to and from database
how to send and retrieve image along with text to and from database  im using app engine and i have two logics from different sources and i want to combine them. ive used the greeting example from app engine and i have a random
how to retrieve image from mysql database using java and show it in HTML img tag ?
how to retrieve image from mysql database using java and show it in HTML img tag ?  how to retrieve image from mysql database using java and show it in HTML img tag
Retrieve data from database by using sql tag of JSTL SQL library
Retrieve data from database by using sql tag of JSTL SQL library... we will see how retrieve data from database using sql query given by user... of the table: retrieve_database_SqlJstlTag.jsp <
how to retrieve data from database using combobox value without using request.getParameter in jsp - JSP-Servlet
how to retrieve data from database using combobox value without using request.getParameter in jsp  Answer pl
retrieve record from table
retrieve record from table  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 the field table. Actually
retrieve data from database in java swing form using prev n next buttons
retrieve data from database in java swing form using prev n next buttons  i have a database having columns id(int),path(text),width(int),height(int... of various rows from database in labels by clicking previous and next
retrieve data from database in java swing form using prev n next buttons
retrieve data from database in java swing form using prev n next buttons  i have a database having columns id(int),path(text),width(int),height(int... of various rows from database in labels by clicking previous and next
how to retrieve the id value itself from the access database to drop down listbox in jsp
how to retrieve the id value itself from the access database to drop down listbox in jsp  how to retrieves the id which is an int datatype, from access database to drop down list box in jsp...plz send the code for that.....plz
How to Retrieve data from database in jsp
How to Retrieve data from database in jsp In this section we will discuss... are going to discus about retrieve data from database in jsp.First of all we have...;font><strong>Retrieve data from database in jsp</strong><
Retrieve The Data From MySql Datbase
Retrieve The Data From MySql Datbase   How to Retrieve The Data From MYSQL database TO Use Select the Emp_id Option.And Also Search Option
How to retrieve data from database by using combo box value in jsp? - JSP-Servlet
How to retrieve data from database by using combo box value in jsp?  Hello friend i want use only one jsp page.. but u give 2 pages... I want to work in one page... Pl response.. I do not need getParameter... Pl respose me
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
Select data from Table in Database
the selected data from table in database. The select query in the database retrieve.... The syntax used to retrieve the record from database are as : The insert... Select data from Table in Database   
Retrieve Value from Table - Hibernate
Retrieve Value from Table   Hai friend, I need help, How can i retrieve values From database using hibernate in web Application. As I new to hibernate I couldn't find solution for this problem.. Can anyone help please.. 
retrieve record from the field table
retrieve record from the field table  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 the field table
How to retrieve record from table
How to retrieve record from table  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 the field table
Retrieve Date Time Frm Database - Development process
Retrieve Date Time Frm Database  Hi Friend, Ow to retrieve Date and Time at a time from ms Access database. For Storing data time... is inserted into the database"); statement.close(); connection.close
 

 

 

DMCA.com