I've created a webpage in asp to display a table from SQL database. I then added Buttons to each table row to update and delete each row code -
do while not objRS.EOF
%>
<tr>
<td><%= objRS("Id") %> </td>
<td><%= objRS("Name") %> </td>
<td><%= objRS("Address") %></td>
<td><%= objRS("Suburb") %></td>
<td><%= objRS("Postcode") %></td>
<td><%= objRS("Age") %></td>
<td><%= objRS("Email") %></td>
<td><Center><input type="submit" value="Update"></Center></td>
<td><center><input type="Submit" onclick="delete(<%= objRS("Id") %>)" value="Delete"></center></td>
</tr>
<%
objRS.MoveNext
loop
objCon.close
%>
also i the code to delete -
Function delete(index)
Dim objCon, objRS, dSQL
set objCon = CreateObject("ADODB.Connection")
objCon.open "Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxxx;Initial Catalog=Customer;Data Source=PC"
dSQL = "DELETE FROM Customer WHERE Id=" & index
objCon.execute(dSQL)
objCon.close
End Function
I've looked everywhere but cant seem to find how to identify each different button and delete the corresponding row from the database