Delete selected information from database from table
Hi,
I have a small database that keeps track of time off request. I am using ASP for it. What I need to do is add a button or check box that allows a person to delete one of the requests.
I could do this with a drop down menu, but that isn't user friendly enough. Is there a way to add a button or checkbox to each row that would allow the user to select a the info from that field in the table and delete it in the database?
I know the code to delete entries, all I would need is the way to add a button/checkbox at each stage, and how to use it to identify the data to be deleted.
Here is what I have to create the table and get the information:
Code:
<%@ Language=VBScript %>
<%Option explicit
Dim oRs, conn, connect, strSQL
set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\data\users.mdb") & ";Persist Security Info=False"
conn.Open connect %>
<html>
<head>
<script language="JavaScript" src="calendar_us.js"></script>
<script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>
<title> PTO Reqeust Information </title>
</head>
<body>
</form>
<table width="100%" border="1" >
<tr>
<%
dim mynumber
mynumber = request.form("number")
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT * FROM Pto_TBL WHERE Number = '" & mynumber & "'"
oRs.Open strSQL, conn
Response.Write ("<td>") &("ID Number: ") & ("<td>") & ("Start Date: ") & ("<td>") & ("End Date: ") & ("<td>") & ("Hours used: ")& ("<td>")
Do while not oRs.EOF
Response.Write ("<td>") & oRS("ID") & ("<td>") & oRS("StartDate") & ("<td>") & oRS("EndDate") & ("<td>") & oRS("hours") & ("<td>")
Response.Write("<tr>")
oRs.MoveNext
loop
%>
</table>
</body>
</html>
Number is from the previous page, that they enter. If there are any other questions let me know. Thanks for your help.
Arshan, September 2nd, 2009 10:17 AM
Bookmarks