how to delete the row when i click delete hyperlink

From: naveenkumarg1 <member39945_at_dbforums.com>
Date: Wed, 17 Sep 2003 05:27:41 -0400
Message-ID: <3379758.1063790861_at_dbforums.com>


hI,

[Quoted] Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.

thanks

naveen

gudipallyn_at_yahoo.com

<%_at_ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPo-
java.util.Vector,java.util.StringTokenizer" %>

<html>

<head>

<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>Item Details</title>

<script>

function submitPage()

{

document.details.action = "itemdetails.jsp" ;

document.details.submit();

}

</script>

</head>

<body>

<form name="details" action="itemdetails.jsp" method="post">

<%

ConnectionPool pool;

Connection con = null;

Statement st;

ResultSet rs =null;

%>

<table border="0" cellpadding="0" cellspacing="0" width="328">

<tr>

<td width="323" colspan="4"><b>Reference No :</b> <input type="text"
name="txt_refno" size="14">

<input type="submit" value="search" name="search" ></td>

</tr>

<tr>

<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item
Code</b></font></td>

<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item
No</b></font></td>

<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount
</b></font></td>

<td width="80" bgcolor="#000099"> </td>

</tr>

<%

pool= new ConnectionPool();

Utils utils = new Utils();

double total =0.00;

String search =utils.returnString(request.getParameter("search"));

if(search.equals("search"))

{

try

{

String ref_no =utils.returnString(request.getParameter("txt_refno"));

String strSQL="select * from ref_table where refno='" + ref_no + "' ";

con = pool.getConnection();

st=con.createStatement();

rs = st.executeQuery(strSQL);

while(rs.next())

{

String itemcode=rs.getString(2);

int item_no=rs.getInt(3);

double amount= rs.getDouble(4);

total= total + amount;

%>

<tr>

<td width="81"><input type=hidden name=hitem
value=<%=itemcode%>><%=itemcode%></td>

<td width="81"><input type=hidden name=hitemno
value=<%=item_no%>><%=item_no%></td>

<td width="81"><input type=hidden name=hamount
value=<%=amount%>><%=amount%></td>

<td width="80"><a href="">delete</a></td>

</tr>

<%

}

}catch(Exception e){}

finally {

if (con != null) pool.returnConnection(con);

}

}

%>

<tr>

<td width="323" colspan="4">

<p align="right"><b>Total:</b><input type="text" name="txt_total"
size="10" value="<%=total%>"></td>

</tr>

<tr>

<td width="323" colspan="4">

<input type="button" value="save" name="save"></td>

</tr>

</table>

</form>

</body>

</html>

--
Posted via http://dbforums.com
Received on Wed Sep 17 2003 - 11:27:41 CEST

Original text of this message