Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 21st, 2005, 01:43 PM
Authorized User
 
Join Date: Jan 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating/Deleting from SQL using ASP

Hi:

I am trying to update or delete froma SQL database from the web. I have successfully retrieved all of database information. However, I would like to make the first column in the database a link. Once you click on the link you can either update or delete the record. I have searched everywhere for this and cannot find an answer that will work. Please help.


Thanks very much!!!!
 
Old April 21st, 2005, 03:19 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Once the user clicks on the link, you can pass the ID value to another page and either delete the row (delete from <table> where id = idpassedin) OR querty the data base based on the id (selef from <table> where id = idpassedin) and bind the values to controls on a form so then can update. Then call and update statement (Update <table> where ID = idpassedin).
 
Old April 25th, 2005, 08:39 AM
Authorized User
 
Join Date: Jan 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does anybody know of any site where I can get an example?

 
Old April 25th, 2005, 09:12 AM
Authorized User
 
Join Date: Apr 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to EricJ
Default

Tee88, it's a querystring that you need to pass from page to page

 
Old May 6th, 2005, 11:14 AM
Registered User
 
Join Date: May 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are some great sites with tons of Free examples.
Try www.asp101.com or www.4guysfromrolla.com

Code for the link containig the ID of the record you want to delete

<a href="DeleteOrders.asp?idOrder=<%response.write pIdOrder%>"style="font-family: Arial; color: #003366">Click here to Delete Order Number<%response.write pIDOrder%></a>

Or here is an example of Deleting a record. Your connection to the DB is in OpenDB.asp

<%
' Heather P 2001
' Details: Delete selected order
%>

<%
on error resume next

dim conntemp, rstemp, rstemp2, mySql

call openDb()
'Pulls ID of record you want to delete from form or link on previous page
pIdOrder = getUserInput(request.querystring("idOrder"),10)
'Error handling
if pIdOrder="" then
   response.redirect "message.asp?message=You must select the order you want to delete."
end if

' update orders record !

mySql="DELETE RECORD FROM orders1 WHERE idorder=" &pIdorder
set rstemp=conntemp.execute(mySQL)
'Error handling
if err.number <> 0 then
   response.redirect "supporterror.asp?error="& Server.Urlencode("Error in DeleteOrderExec2: "&Err.Description)
end if

response.redirect "message.asp?message=The order information has been deleted"
%>











Similar Threads
Thread Thread Starter Forum Replies Last Post
error in deleting,updating and records in asp method Classic ASP Databases 1 May 6th, 2005 10:35 AM
updating and deleting record PinkyCat Classic ASP Databases 4 March 16th, 2005 05:50 AM
Updating & Deleting Rows from a Repeater saturdave ASP.NET 1.0 and 1.1 Basics 4 February 19th, 2004 04:35 PM
Deleting Tables in SQL using ASP and VB Script sideshow245 Classic ASP Databases 1 February 2nd, 2004 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.