<% @ Language=VBScript %> <% Option Explicit %> <% 'Set the response buffer to true Response.Buffer = True 'Dimension variables Dim strMode 'holds the mode of the page, set to true if changes are to be made to the database Dim strCatName 'Holds the name of the category Dim intCatID 'Holds the ID number of the category 'Read in the details intCatID = CInt(Request.QueryString("CatID")) strMode = Request("mode") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT " & strDbTable & "Category.* From " & strDbTable & "Category WHERE " & strDbTable & "Category.Cat_ID=" & intCatID & ";" 'Set the Lock Type for the records so that the record set is only locked when it is updated rsCommon.LockType = 3 'Query the database rsCommon.Open strSQL, adoCon 'If this is a post back then save the category If (strMode = "edit" OR strMode = "new") AND CBool(Request.Form("postBack")) Then 'If this is a new one add new If strMode = "new" Then rsCommon.AddNew 'Update the recordset rsCommon.Fields("Cat_name") = Request.Form("category") 'Update the database with the category details rsCommon.Update 'Release server varaibles rsCommon.Close Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing Response.Redirect("view_forums.asp") 'Re-run the query to read in the updated recordset from the database rsCommon.Requery End If 'Read in the forum details from the recordset If NOT rsCommon.EOF Then 'Read in the forums from the recordset intCatID = CInt(rsCommon("Cat_ID")) strCatName = rsCommon("Cat_name") End If 'Release server varaibles rsCommon.Close Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing %> FORUM CATEGORY FORUM CATEGORY

ADD NEW FORUM CATEGORY
CATEGORY*