tanhaha_how
03-09-2006, 07:24 AM
Hi.........help me please!!!Everytime i delete record....the record still appear....the record will only disappear after i refresh the page.....
can anyone help me please???thanks
<%
haha = request("a")
Set objConn = Server.CreateObject("ADODB.Connection")
Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn.Open(conn_string)
objConn2.Open(conn_string1)
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS2 = Server.CreateObject("ADODB.Recordset")
Set objRS3 = Server.CreateObject("ADODB.Recordset")
Set objRS4 = Server.CreateObject("ADODB.Recordset")
Response.Expires = 0
mySQL = "SELECT * FROM tblpayment"
objRS.Open mySQL, objConn
mySQL2 = "SELECT * FROM tblpayment"
objRS2.Open mySQL2, objConn
mySQL3 = "SELECT * FROM tblpayment"
objRS3.Open mySQL3, objConn
mySQL4 = "SELECT * FROM tblpayment"
objRS4.Open mySQL4, objConn
%>
<html>
<head><title></title></head>
<body>
<center class=header>Bank payment record</center>
<FORM NAME = "form" METHOD="POST" ACTION="PaymentRecord.asp">
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Public Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS.EOF %>
<% if objRS("bankID") = "1" then %>
<TR>
<td><%=objRS("paymentDate") %></TD>
<td><%=objRS("email") %></td>
<td align="center"><input type=checkbox name=delete value = <%=CInt(objRS("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Maybank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS2.EOF %>
<% if objRS2("bankID") = "2" then %>
<TR>
<td><%=objRS2("paymentDate") %></TD>
<td><%=objRS2("email") %></td>
<td align="center"><input type=checkbox name=delete value = <%=CInt(objRS2("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS2.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Alliance Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS3.EOF %>
<% if objRS3("bankID") = "3" then %>
<TR>
<td><%=objRS3("paymentDate") %></TD>
<td><%=objRS3("email") %></td>
<td align=center><input type=checkbox name=delete value = <%=CInt(objRS3("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS3.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: RHB Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS4.EOF %>
<% if objRS4("bankID") = "4" then %>
<TR>
<td><%=objRS4("paymentDate") %></TD>
<td><%=objRS4("email") %></td>
<td align=center><input type=checkbox name=delete value = <%=CInt(objRS4("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS4.MoveNext %>
<% loop %>
<table border="0" height="10" align="center">
<tr><td></td></tr>
</table>
<p>
<table width="628" border="0" align="center">
<tr colspan="3"><td width="108" height="2"></td>
</tr>
<tr>
<td width="10"></td>
<td width="491"></td>
<td width="56">
<input type=submit value="Delete record !" onclick=change("delete")>
</td>
</tr>
</table>
<input type="hidden" name="a">
</FORM>
</p>
<%
'Clean up our ADO objects
objRS.Close
Set objRS = Nothing
objRS2.Close
Set objRS2 = Nothing
objRS3.Close
Set objRS3 = Nothing
objRS4.Close
Set objRS4 = Nothing
objConn.Close
Set objConn = Nothing
%>
<%
'We want to delete our products. The list of ProductIDs that need to be deleted are in a comma-delimited list...
Dim strDeleteList
strDeleteList = Request("delete")
if haha = "delete" then
if strDeleteList <> "" then
'Open a connection to the database
'Dim objConn
'Set objConn = Server.CreateObject("ADODB.Connection")
'objConn.ConnectionString = "DSN=Products"
'objConn.Open
Set objConn = Server.CreateObject("ADODB.Connection")
Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn.Open(conn_string)
objConn2.Open(conn_string1)
'Now, use the SQL set notation to delete all of the records specified by strDeleteList
Dim strSQL
strSQL = "DELETE FROM tblpayment " & _
"WHERE paymentID IN (" & replace(strDeleteList, "'", "''") & ")"
objConn.Execute strSQL
'Clean up
objConn.Close
Set objConn = Nothing
'Display to the user that the product have been deleted.
if Request("Delete").Count = 1 then
Response.Write Request("Delete").Count & " product were deleted..."
else
Response.Write Request("Delete").Count & " products were deleted..."
end if
else
Response.Write "<span class=red><center>You did not select any items to delete!</center></span>"
end if
end if
%>
<form action="../../../index.asp">
<input type="submit" value="Back to Main">
</form>
</body>
</html>
<script language="vbscript">
<!--
sub change(operation)
form.a.value=operation
form.submit
end sub
-->
</script>
can anyone help me please???thanks
<%
haha = request("a")
Set objConn = Server.CreateObject("ADODB.Connection")
Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn.Open(conn_string)
objConn2.Open(conn_string1)
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS2 = Server.CreateObject("ADODB.Recordset")
Set objRS3 = Server.CreateObject("ADODB.Recordset")
Set objRS4 = Server.CreateObject("ADODB.Recordset")
Response.Expires = 0
mySQL = "SELECT * FROM tblpayment"
objRS.Open mySQL, objConn
mySQL2 = "SELECT * FROM tblpayment"
objRS2.Open mySQL2, objConn
mySQL3 = "SELECT * FROM tblpayment"
objRS3.Open mySQL3, objConn
mySQL4 = "SELECT * FROM tblpayment"
objRS4.Open mySQL4, objConn
%>
<html>
<head><title></title></head>
<body>
<center class=header>Bank payment record</center>
<FORM NAME = "form" METHOD="POST" ACTION="PaymentRecord.asp">
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Public Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS.EOF %>
<% if objRS("bankID") = "1" then %>
<TR>
<td><%=objRS("paymentDate") %></TD>
<td><%=objRS("email") %></td>
<td align="center"><input type=checkbox name=delete value = <%=CInt(objRS("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Maybank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS2.EOF %>
<% if objRS2("bankID") = "2" then %>
<TR>
<td><%=objRS2("paymentDate") %></TD>
<td><%=objRS2("email") %></td>
<td align="center"><input type=checkbox name=delete value = <%=CInt(objRS2("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS2.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: Alliance Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS3.EOF %>
<% if objRS3("bankID") = "3" then %>
<TR>
<td><%=objRS3("paymentDate") %></TD>
<td><%=objRS3("email") %></td>
<td align=center><input type=checkbox name=delete value = <%=CInt(objRS3("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS3.MoveNext %>
<% loop %>
<table border="0" height="50" align="center">
<tr><td></td></tr>
</table>
<table border=1 align=center>
<TR bgcolor="#99FFFF">
<th colspan="3" align="left">Bank: RHB Bank</Th>
</tr>
<tr bgcolor="#CCCCCC">
<th width="200" align="left"><span class="label">Date (yyyy-mm-dd)</span></th>
<th width="300" align="left"><span class="label">Email</span></th>
<th width="100" align="center"><span class="label">Delete</span></th>
</tr>
<% Do While Not objRS4.EOF %>
<% if objRS4("bankID") = "4" then %>
<TR>
<td><%=objRS4("paymentDate") %></TD>
<td><%=objRS4("email") %></td>
<td align=center><input type=checkbox name=delete value = <%=CInt(objRS4("paymentID")) %>>Yes</td>
</tr>
<% end if %>
<% objRS4.MoveNext %>
<% loop %>
<table border="0" height="10" align="center">
<tr><td></td></tr>
</table>
<p>
<table width="628" border="0" align="center">
<tr colspan="3"><td width="108" height="2"></td>
</tr>
<tr>
<td width="10"></td>
<td width="491"></td>
<td width="56">
<input type=submit value="Delete record !" onclick=change("delete")>
</td>
</tr>
</table>
<input type="hidden" name="a">
</FORM>
</p>
<%
'Clean up our ADO objects
objRS.Close
Set objRS = Nothing
objRS2.Close
Set objRS2 = Nothing
objRS3.Close
Set objRS3 = Nothing
objRS4.Close
Set objRS4 = Nothing
objConn.Close
Set objConn = Nothing
%>
<%
'We want to delete our products. The list of ProductIDs that need to be deleted are in a comma-delimited list...
Dim strDeleteList
strDeleteList = Request("delete")
if haha = "delete" then
if strDeleteList <> "" then
'Open a connection to the database
'Dim objConn
'Set objConn = Server.CreateObject("ADODB.Connection")
'objConn.ConnectionString = "DSN=Products"
'objConn.Open
Set objConn = Server.CreateObject("ADODB.Connection")
Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn.Open(conn_string)
objConn2.Open(conn_string1)
'Now, use the SQL set notation to delete all of the records specified by strDeleteList
Dim strSQL
strSQL = "DELETE FROM tblpayment " & _
"WHERE paymentID IN (" & replace(strDeleteList, "'", "''") & ")"
objConn.Execute strSQL
'Clean up
objConn.Close
Set objConn = Nothing
'Display to the user that the product have been deleted.
if Request("Delete").Count = 1 then
Response.Write Request("Delete").Count & " product were deleted..."
else
Response.Write Request("Delete").Count & " products were deleted..."
end if
else
Response.Write "<span class=red><center>You did not select any items to delete!</center></span>"
end if
end if
%>
<form action="../../../index.asp">
<input type="submit" value="Back to Main">
</form>
</body>
</html>
<script language="vbscript">
<!--
sub change(operation)
form.a.value=operation
form.submit
end sub
-->
</script>