Jump to content

asp buttons


Guest aspflower
 Share

Recommended Posts

Guest aspflower

Sir,I have a created a projt in asp,(in java script)where u have a delete buttons .My problem z whenever i click that button the relevant data is not getting deleted but its getting displayed in the list.I need a solution for deleting that particular record in the asp page that should not affect in the database...

Link to comment
Share on other sites

Sir,I have a created a projt in asp,(in java script)where u have a delete buttons .My problem z whenever i click that button the relevant data is not getting deleted but its getting displayed in the list.I need a solution for deleting that particular record in the asp page that should not affect in the database...

First, display your records, and be sure when you click the delete button, you pass the record's unique ID as querystring data:
Dim Conn, RS, sqlConn = Server.CreateObject("ADODB.Connection")RS = Server.CreateObject("ADODB.RecordSet")sql = "Select * From your_table"Conn.Open YourDSN    rs.open sql, Conn, 1, 1,    %>    <a href="delete.asp?ID=<%=RS("ID")%>">Delete</a> Other field data here<br>    <%    RS.CloseConn.Close

On another page, use this code to delete your record:

 Dim Conn, RS, sqlSet Conn = Server.CreateObject("ADODB.Connection")sql = "Delete * From your_table WHERE ID = " & request("ID")Conn.Open YourDSNSet RS = Conn.Execute(sql)Conn.Close

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...