editing cell in a table

Ads

 
 

Share on Google+Share on Google+

ebuka
editing cell in a table
1 Answer(s)      8 years ago
Posted in : JDBC
Ads
View Answers

July 1, 2009 at 1:24 PM


Hi Friend,

Try the following code:

1)updateDatabase.jsp

<%@page import="java.sql.*"%>

<form name=myname method=post action="update.jsp">
<table border="1">
<tr>
<td><b><u>RollNo</u></b></td>
<td><b><u>Name</u></b></td>
<td><b><u>Class</u></b></td>
</tr>
<%try{

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root";, "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
rs = st.executeQuery("select * from employee where emp_id='2'");
while(rs.next()){ %>
<tr>
<td><input type="text" name="eid" value="<%= rs.getString("emp_id") %>"></td>
<td><input type="text" name="ename" value="<%= rs.getString("empName") %>"></td>
<td><input type="text" name="eadd" value="<%= rs.getString("empAddress") %>"></td>
</tr>
<%}
}
catch(SQLException e){}
%>
</table>
<input type="Submit">

2) update.jsp
<%@page import="java.sql.*"%>
<% String id=request.getParameter("eid");
String name=request.getParameter("ename");
String address=request.getParameter("eadd");
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 empName='"+name+"', empAddress='"+address+"' where emp_id='"+id+"'");
out.println("Data is updated successfully.");
}
catch(Exception e){}
%>

Thanks


Ads









Related Tutorials/Questions & Answers:
editing cell in a table - JDBC
editing cell in a table  how can i edit a cell in a table and save the change to a database  Hi Friend, Try the following code: 1)updateDatabase.jsp RollNo Name Class "> "> ">
how to allow table editing
how to allow table editing   1**. hi... l've tried the method isCellEditable(int rowIndex, int colIndex) { return true but it doesn't enabled the user the editing of any cell why????????????? regards
Advertisements
css table cell margin
css table cell margin  How can i put margin between two columns(cell margin)?   In your CSS you can set the desired margin between two cells as given below.. padding-right:10px;   now you need to call
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
image on div or cell of table
image on div or cell of table  I am using ms access database and I... but it display on browser but I want to display on inside the div tag or table tag pls... is to display on div or table... thnx in advance
Height for cell in table view - UITableView
Height for cell in table view - UITableView  UITableview height for cell What is the height for cell in table view iPhone mobile application
Table Empty Cell in HTML
Table Empty Cell in HTML       The Table Empty Cell in HTML define no content inside a cell of table. The code is not able to display border around the empty cell in a table
Query on Java Swing - Table Cell Issue - Swing AWT
Query on Java Swing - Table Cell Issue  Hi, I have a query on Java... the key board focus is moving from one cell to another table cell but I am unable to show the cursor in the focused cell which is editable. what do I need do
Editing the Profile
Editing the Profile  how to populate drop-down menu instead of text box in editing the profile
restrict jtable editing
restrict jtable editing  How to restrict jtable from editing or JTable disable editing?   public class MyTableModel extends AbstractTableModel { public boolean isCellEditable(int row, int column
differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding
change content of cell javascript
change content of cell javascript  change content of cell javascript
Display of value in Tabel cell
in the table cell by defining the cell editor.The cell is having a text field and calendar.When i select a date in the calendar the date will be displayed in the cell...) The format the cell is showing when its in focus - Mon,dd,yyyy(Mar,01,2011). I
Auto select cell on mouse hover using 'hover' mouse event
Auto select cell on mouse hover using 'hover' mouse event In this tutorial, we will discuss about how to highlight Table's cell on mouse hover using jQuery 'hover' mouse event. In this example, a table is given
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
Subtitle in Table View  iPhone
cell of the Table view and index to Table view. As explain about the Table view... using the same concept will add the object into the cell of Table View and added... to the cell of Table View. After that will set the frame of the cell and also
JSP:HTML Form in-place Editing - JSP-Servlet
developer's needs. This is a follow up to the HTML Form in-place editing. The code... an excellent way of editing a form. I just have a few adjustments if any of you could... to be able to open a page instead of a window for the editing which opens
table
table  multiplicatyion table
TABLE
TABLE   Why doesn't <TABLE WIDTH="100%"> use the full browser width
Table
Table  How i generate table in showMessageDialog. I want that i creat a table and run in showMessageDialogeprint("cprint("code sample");ode sample
Table
Table  How I generate table in showMessageDialog. E.g 3X1=3 3X2=6 3X3=9print("code sample
Table
Table  How i generate table in showMessageDialog. I want to creat a table and run in showMessageDialoge. Pl make a table programe which run..., JOptionpane, Integer.parseInt. Please use only these above methods to make table
table
input from oracle table(my database table..) This is a very important table of my
table
table  Hi..I have a list of links which links to a table in the same page.If I click first link the table is displayed at the top, likewise if i click the last link the table is displayed at the last,i dont know how to set
Table
Table  How i generate table in JOptionpane.showMessageDialog... advance coding but i want u make the table using JOptionpane.showMessageDialog, import.javax.swing int Integer.parseInt(). Thats my limit. Pl generata a table
table?
table?  Hi, how could i make a table in javascript, which would look like this: AA CODON Number /1000 Fraction .. (this row... can't figure out, how to construct a table,with two fixed columns, one that reads
Table
Table  Why u dont understand sir?? I want to make a table program which generate a table on showMessageDialog. I have learnt these methods until now... methods to be used. Write a table program which use only and only these above methods

Ads

 
Advertisement null

Ads