Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multible record deletions by check box

Status
Not open for further replies.

Dostani

MIS
Jul 26, 2002
60
US
Greeting all,

I have a page that I need to have complete stock listing on. The page would present the user with all the stock in the DB. I would like to be able to provide a single or multible delete function via check boxes. The user would select from the listing the stock to be deleted and then delete only the chosen records from the DB. Not sure just how to provide this type of action. Can someone please example or walk me through what is needed to do so???? <<PLEASE>>

Dostani
 
Just have a checkbox next to the record and name it delete and then at the top of the page you would have:
<%If Request.Form(&quot;delete&quot;) <> &quot;&quot; Then%>
<!--#include file=&quot;/Connections/db.asp&quot; -->
<%
delIDs = Request.Form(&quot;delete&quot;)

set rs = Server.CreateObject(&quot;ADODB.Command&quot;)
rs.ActiveConnection = MM_db_STRING
rs.CommandText = &quot;DELETE FROM dbo.YourTable WHERE IdentityField IN (&quot; & delIDs & &quot;)&quot;
rs.CommandType = 1
rs.CommandTimeout = 0
rs.Prepared = true
rs.Execute()
Response.Redirect(&quot;NameOfYourPage.asp&quot;)
%>
<%End If%>


If you have problems with this reply with your page code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top