|
 |
asp_databases thread: Recordset Delete Variable
Message #1 by "Robert Sidebotham" <einstein_2005@y...> on Fri, 14 Sep 2001 18:36:38
|
|
Can anybody tell me why this doesn't work. I have a form on one asp page
that another asp page requests information from. The form is basically a
drop down list of all records in a database. I want to be able to choose a
record from the drop-down menu and on submitting the form, it to be
deleted from the database.
deletes = Request.Form("recordfordelete")
rsAddresses.Filter = "Full Name = deletes"
rsAddresses.Delete = adAffectGroup
Thanks in advance.
Robert Sidebotham
Message #2 by "Drew, Ron" <RDrew@B...> on Fri, 14 Sep 2001 16:30:39 -0400
|
|
not sure ...but I know this works...rs typically means recordset and I use
command
<%@ Language=VBScript %>
<!--#Include file = "include/adovbs.inc" -->
<%
Dim conntemp, objRS, sqltemp, objCommand
set conntemp=server.createobject("adodb.connection")
set objCommand = Server.CreateObject("ADODB.Command")
conntemp.open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\InetPub\wwwroot\yourdb.mdb;" & _
"User Id=admin;" & _
"Password=;"
objCommand.ActiveConnection = conntemp
' change the next line to your request.form.........
form_ID=request.querystring("which")
sqltemp="delete from yourtable "
sqltemp=sqltemp & "where appID=" & form_ID
objCommand.CommandText = sqltemp
objCommand.Execute
Response.Write form_ID & " has been deleted"
conntemp.close
set conntemp=Nothing
set objCommand=Nothing
%>
<html>
<head>
<title>Delete Records</title>
</head>
<body>
<div align="center"> <button type="button"
onClick="javascript:history.go(-1);" id=button1 name=button1>Back
to Selection</button> </div>
</body>
</html>
-----Original Message-----
From: Robert Sidebotham [mailto:einstein_2005@y...]
Sent: Friday, September 14, 2001 2:37 PM
To: ASP Databases
Subject: [asp_databases] Recordset Delete Variable
Can anybody tell me why this doesn't work. I have a form on one asp page
that another asp page requests information from. The form is basically a
drop down list of all records in a database. I want to be able to choose a
record from the drop-down menu and on submitting the form, it to be
deleted from the database.
deletes = Request.Form("recordfordelete")
rsAddresses.Filter = "Full Name = deletes"
rsAddresses.Delete = adAffectGroup
Thanks in advance.
Robert Sidebotham
Message #3 by Steve Carter <Steve.Carter@t...> on Mon, 17 Sep 2001 10:04:26 +0100
|
|
>
> deletes = Request.Form("recordfordelete")
> rsAddresses.Filter = "Full Name = deletes"
try
rsAddresses.Filter = "Full Name = '" & deletes & "'"
or (better)
rsAddresses.Filter = "Full Name = '" & replace(deletes,"'","''") & "'"
> rsAddresses.Delete = adAffectGroup
>
Message #4 by "Robert Sidebotham" <einstein_2005@y...> on Mon, 17 Sep 2001 12:54:14
|
|
> >
> > deletes = Request.Form("recordfordelete")
>
> > rsAddresses.Filter = "Full Name = deletes"
>
> try
>
> rsAddresses.Filter = "Full Name = '" & deletes & "'"
>
> or (better)
>
> rsAddresses.Filter = "Full Name = '" & replace(deletes,"'","''") & "'"
>
> > rsAddresses.Delete = adAffectGroup
> >
Thanks for that. This is the code that I was after.
|
|
 |