ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

ASP/SQL Delete



Right I must have viewed about 10'000 tutorials today, lol (slight exageration) basically ive got a table, and I want to put an extra column on the end which will contain a link at the end of each record saying "delete" and when they click delete it deletes that current record. Ive searched everywhere but no luck!

tableview.jpg


My code for the above table is as follows:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/myconnection.asp" -->
<%
Dim rsstaff
Dim rsstaff_numRows

Set rsstaff = Server.CreateObject("ADODB.Recordset")
rsstaff.ActiveConnection = MM_myconnection_STRING
rsstaff.Source = "SELECT * FROM staff"
rsstaff.CursorType = 0
rsstaff.CursorLocation = 2
rsstaff.LockType = 1
rsstaff.Open()

rsstaff_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsstaff_numRows = rsstaff_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p align="center"><strong>Staff List</strong></p>
<div align="center"></div>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="12%"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Staff ID</font></div></td>
<td width="20%"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Surname</font></div></td>
<td width="19%"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Forename</font></div></td>
<td width="17%"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Date of Birth </font></div></td>
<td width="32%"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Department</font></div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsstaff.EOF))
%>
<tr>
<td>
<div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><%=(rsstaff.Fields.Item("staffid").Value)%></font></div></td>
<td>
<div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><%=(rsstaff.Fields.Item("sname").Value)%></font></div></td>
<td>
<div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><%=(rsstaff.Fields.Item("fname").Value)%></font></div></td>
<td>
<div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><%=(rsstaff.Fields.Item("dob").Value)%></font></div></td>
<td>
<div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><%=(rsstaff.Fields.Item("dept").Value)%></font></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsstaff.MoveNext()
Wend
%>
</table>


<p>&nbsp; </p>
</body>
<%
rsstaff.Close()
Set rsstaff = Nothing
%>


Basically im just wondering if anyone knows a simple way of doing this and could show me how to do it!

Cheers
 


Top