<% Session("CurrentPage") = "AdminDiscs" Dim dbConn Dim strX Dim Rs 'Open up a database connection and set up the recordset Set dbConn = Session("dbConn") Set Rs = Server.CreateObject("adodb.recordset") Rs.Cursortype=adOpenDynamic Rs.LockType=adLockOptimistic If rqs("do") = "add" or rqs("do") = "edit" Then 'Get the details from the user via a form rsw( strHeader ) IF rqs("do") = "add" Then strX = "SELECT * FROM Discs WHERE [ID] < 0" Else strX = "SELECT * FROM Discs WHERE [ID] = " & rqs("id") End If Rs.Open strX, dbConn rsw("") %>
Date
Cat No.
Title
Details
  Submit Back 
Delete
  <% x = strText( Rs,"PicLink" ) If Len(x) < 1 Then rsw("-- none --") Else rsw("" & x & "") End If %>
<% Rs.Close ElseIf rqs("do") = "delete" Then 'delete the record' on error resume next If rqs("id") <> "" Then cSQL = "DELETE * FROM Discs WHERE ID = " & rqs("id") dbConn.Execute(cSQL) End If If Err.Number = 0 Then response.redirect( Session("CurrentPage") & ".asp" ) Else rsw( strHeader ) WriteDBError "CANT DELETE THE RECORD",err.Description,cSQL End If on error goto 0 ElseIf rqs("do") = "deletepic" Then 'delete the record' on error resume next If rqs("id") <> "" Then cSQL = "UPDATE Discs SET PicLink = NULL WHERE ID = " & rqs("id") dbConn.Execute(cSQL) End If If Err.Number = 0 Then response.redirect( Session("CurrentPage") & ".asp" ) Else rsw( strHeader ) WriteDBError "CANT DELETE THE PICTURE",err.Description,cSQL End If on error goto 0 ElseIf rqs("do") = "deleteaudio" Then 'delete the record' on error resume next If rqs("id") <> "" Then cSQL = "UPDATE Discs SET AudioLink = NULL WHERE ID = " & rqs("id") dbConn.Execute(cSQL) End If If Err.Number = 0 Then response.redirect( Session("CurrentPage") & ".asp" ) Else rsw( strHeader ) WriteDBError "CANT DELETE THE AUDIO SAMPLE",err.Description,cSQL End If on error goto 0 ElseIf rqs("do") = "update" Then 'Submit the details back to the database IF rqf("id") < "1" Then cSQL = "INSERT INTO Discs( Reference,PublishDate, Title,TrackList ) " & _ "VALUES( " & _ strSQLField(rqf("reference"),"c") & ", " & _ strSQLField(rqf("publishdate"),"d") & ", " & _ strSQLField(rqf("title"),"c") & ", " & _ strSQLField(rqf("tracklist"),"c") & " )" Else cSQL = "UPDATE Discs SET " & _ "[Reference] = " & strSQLField(rqf("reference"),"c") & ", " & _ "[PublishDate] = " & strSQLField(rqf("publishdate"),"d") & ", " & _ "[Title] = " & strSQLField(rqf("title"),"c") & ", " & _ "[TrackList] = " & strSQLField(rqf("tracklist"),"c") & " " & _ "WHERE ID = " & rqf( "id" ) End If on error resume next dbConn.Execute(cSQL) If Err.Number = 0 Then response.redirect( Session("CurrentPage") & ".asp" ) Else rsw( strHeader ) WriteDBError "CANT UPDATE THE RECORD",err.Description,cSQL End If on error goto 0 Else %>
Discs [Click Here To Add]
<% rsw( DiscList( "e" ) ) End If %>