troubleshooting Question

How to add DELETE action in an ASP page?

Avatar of Stiebel Eltron
Stiebel EltronFlag for Thailand asked on
Web DevelopmentASPSQL
4 Comments1 Solution310 ViewsLast Modified:
</head>

<body bgproperties="fixed" bgcolor="#000000" onLoad="javascript:startmenu()">

<%
	Dim myConnection
	Dim rsUsers
	Dim connectString
	Dim sqlString
	Dim requestName

	connectString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=DBSERVER; PORT=3306; DATABASE=DB; USER=DBUSER; PASSWORD=DBPW; OPTION=0;"

	Set myConnection = Server.CreateObject("ADODB.Connection")
	Set rsUsers = Server.CreateObject("ADODB.Recordset")

	myConnection.Open connectString

	requestName = Request.Form("USERID")
	response.Write(requestName)

	sqlString = "Select * From users WHERE ID = 1"
	
	Set rsUsers = myConnection.Execute(sqlString)

%>

<table width="760" border="0" cellspacing="3" cellpadding="1">
  <tr>
    <td width="134"><img src="../IMG/logo_res.jpg" alt="STIEBEL ELTRON" /></td>
    <td width="620" valign="top" bgcolor="#666666"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="548" height="197">
      <param name="movie" value="homeintro20.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <embed src="homeintro20.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="548" height="197"></embed>
    </object></td>
    <td width="134" bgcolor="#FFFFFF"><img src="../IMG/RegIcon.png" alt="ASIA" border="0" align="top"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right" bgcolor="#999999"><font face="Verdana, Geneva, sans-serif" color="#ffffff">
    <%
   '// If user is logged in show name and logout link
   If Session("loggedin") = true Then
      Response.Write "Welcome: " & Session("FName")
      Response.Write "<br /><a href=""../asia2/login/logout.asp"">Logout</a>"
   Else
      Response.Write "<a href=""../ste-iphoto-login2.asp"" title=""CLICK TO LOGIN"">REGISTERED USERS</a>"
   End If
	%>&nbsp;
	</td>
    <td bgcolor="#666666" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="left" bordercolor="#999999" bgcolor="#000000"><img src="../IMG/member.jpg" width="548" /><br></td>
    <td bgcolor="#999999" valign="top" align="center" rowspan=13>&nbsp;
		
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
    	<table width="100%" border="1" bordercolor="#cccccc" cellpadding="0" bgcolor="#999999">
    		<form name="form" id="form" method="post" action="#" onSubmit="return checkform(this)">
			<!--Get DATA-->
		<% do while not rsUsers.EOF %>
    		<tr>
        		<td class="td1" width="23%" align="right">First Name:</td>
           		<td class="td2" width="77%"><%=rsUsers("FName")%></td>
        	</tr>
    		<tr>
        		<td class="td1" width="23%" align="right">Last Name:</td>
           		<td class="td2" width="77%"><%=rsUsers("LName")%>
                </td>
        	</tr>
           	<tr>
        		<td class="td1" width="23%" align="right">Email:</td>
           		<td class="td2" width="77%"><%=rsUsers("Email")%>
            	</td>
        	</tr>

      
    		<tr>
        		<td class="td1" width="23%" align="right">Password:</td>
           		<td class="td2" width="77%"><%=rsUsers("Password")%>
                </td>
        	</tr>
        	<tr>
        		<td class="td1" width="23%" align="right">Country:</td>
           		<td class="td2" width="77%"><%=rsUsers("Country")%>
         	   </td>
        	</tr>
	        <tr>
    	    	<td class="td1" width="23%" align="right">Telephone:</td>
        	   	<td class="td2" width="77%"><%=rsUsers("Telephone")%>
                </td>
        	</tr>
        	<tr>
        		<td class="td1" width="23%" align="right">Mobile:</td>
           		<td class="td2" width="77%"><%=rsUsers("Mobile")%>
                </td>
        	</tr>
	    	<tr>
    	    	<td class="td1" width="23%" align="right">Company:</td>
        	   	<td class="td2" width="77%"><%=rsUsers("Company")%>
                </td>
        	</tr>
    		<tr valign="top">
        		<td class="td1" width="23%" align="right">Address:</td>
           		<td class="td2" width="77%"><%=rsUsers("Address")%></td>
        	</tr>
    		<tr valign="top">
        		<td class="td1" width="23%" align="right">Activate:</td>
           		<td class="td2" width="77%"><input type="radio" name="Activate" id="Yes"/>&nbsp;YES&nbsp;&nbsp;<input type="radio" name="Activate" id="No" />NO</td>
        	</tr>
            
	        <tr>
        		<td class="td" width="23%" align="right">&nbsp;</td>
           		<td width="77%"><input name="Submit" type="submit" value="UPDATE" onclick="return checkform();" />&nbsp;
                <input name="Delete" type="submit" value="DELETE" onclick="return checkform();" />
                </td>
        	</tr>
			


        </form>
        
       <% rsUsers.MoveNext %>
<%loop %><!--Next Row-->
    </table>

Dear EE experts,

Please see the attached embed scripts, we would like to ask for tech support on how to add a delete action on the same page.
If you click the delete button, the action should delete that item and update the database as well, then will refresh and redirects to another page...

Thank you in advance and hope to hear soon...
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros