%
Set db = Server.CreateObject("ADODB.Connection")
set rs = server.createObject("ADODB.Recordset")
'
if request("action")="delete" then
%>
Are you sure you want to delete this artist and all albums by them?
">YES NO
<%
end if
if request("action")="deleteconfirmed" then
response.write "Deleting Artist... "
db.execute("delete from artists WHERE id='" & request("id") & "'")
response.write "Done.
"
response.write "Deleting Songs (files will not be deleted)... "
rs.open "select * from albums WHERE artistid='" & request("id") & "'", db
do while NOT rs.eof
db.execute("delete from songs WHERE albumid='" & rs("id") & "'")
'db.execute("delete from videos WHERE albumid='" & rs("id") & "'")
rs.movenext
loop
rs.close
response.write "Done.
"
response.write "Deleting Albums... "
db.execute("delete from albums WHERE artistid='" & request("id") & "'")
response.write "Done.
"
end if
if request("action")="edit" then
if request("actionb")="save" then
if len(request("artist"))>0 then myArtist=replace(request("artist"),"'","þ") else myError="Please enter the artist name."
if len(request("Description"))>0 then myDescription=replace(request("Description"),"'","þ") else myError="Please enter a description of the artist."
if len(request("id"))>0 then myID=request("id") else myError="Artist ID not supplied. Halted."
if len(myError)<1 then
response.write "Updating Artist... "
db.execute("UPDATE artists set artist='" & myArtist & "',description='" & myDescription & "' WHERE id='" & request("id") & "'")
response.write "Done."
end if
else
rs.open "select * from artists WHERE id='" & request("id") & "'", db
if NOT rs.eof then
myArtist=replace(rs("artist"),"þ","'")
myDescription=replace(rs("description"),"þ","'")
myID=rs("id")
else
myError="Invalid artist ID."
end if
end if
end if
if request("action")="" then
rs.open "select * from artists", db
%>
| Artist | Action |
| <%=rs("artist")%> | ">Edit - ">Delete |