% if (isNull(request.cookies("ckyUserID"))) or (request.cookies("ckyUserID")="") then response.redirect "index.asp" end if %> <% rowCount = 0 if getUserType(Request.Cookies("ckyUserID"))<>47 then 'response.redirect "home.asp" blnAdmin = false else blnAdmin = true end if if (Request.QueryString("btnSave") = "Save") and (blnAdmin) then CategoryID = Request.QueryString("CategoryID") strDescription = fixquote(Request.QueryString("strDescription")) if CategoryID > 0 then s = "SELECT * From tblCategory WHERE strDescription = '" & strDescription & "' AND CategoryID <> " & CategoryID set rst = cn.execute(s) if not rst.eof then Response.Write "" lngID = CategoryID else s = "Update tblCategory Set strDescription = '" & strDescription & "' WHERE CategoryID = " & CategoryID set rst2 = cn.execute(s) end if rst.close else s = "SELECT * From tblCategory WHERE strDescription = '" & strDescription & "'" set rst = cn.execute(s) if not rst.eof then btnAdd = "Add" Response.Write "" else s = "Insert Into tblCategory (strDescription) values ('" & strDescription & "')" set rst2 = cn.execute(s) end if rst.close end if elseif (Request.QueryString("btnDelete") = "Delete") and (blnAdmin) then intNotDeleted=0 arrID = split(Request.QueryString("arrID"),",") for i = 0 to ubound(arrID) s = "Select * From tblPublication WHERE refCategoryID = " & arrID(i) set rst = cn.execute(s) if not rst.eof then intNotDeleted = intNotDeleted + 1 else s = "Delete From tblCategory WHERE CategoryID = " & arrID(i) set rst2 = cn.execute(s) end if next if intNotDeleted > 0 then Response.Write "" end if end if %>