<% function AddSubGroup(ByRef pobjCon, ByVal pintParentGroupID, ByVal pstrName, ByVal pstrDescription, _ ByVal pblnAllowpostings, ByVal pblnRegistredPostingOnly, _ ByVal pblnReadOnly, ByVal pblnHidden, _ ByVal pblnStrongModeration) Dim objRs, strSQL, intGroupID, intParentDepth, intBoardID, intParentDisplayOrder set objRs = GetGroup(pobjCon, pintParentGroupID) if not objRs.EOF then intParentDepth = objRs.Fields.Item("debth").Value intBoardID = objRs.Fields.Item("board").Value intParentDisplayOrder = objRs.Fields.Item("displayOrder").Value objRs.Close Set objRs = nothing call BeginTransaction(pobjCon, "AddSubGroup") 'make room in displayorder for group strSQL = "UPDATE forumGroups SET displayOrder=displayOrder+1 WHERE board=" & intBoardID & " AND displayOrder>" & intParentDisplayOrder pobjCon.execute strSQL 'insert subgroup Set objRs = Server.CreateObject ("ADODB.Recordset") call objRs.Open("forumGroups", pobjCon, adOpenKeySet, adLockPessimistic, adCmdTable) call objRs.AddNew() objRs.Fields.Item("debth").Value = intParentDepth+1 objRs.Fields.Item("displayOrder").Value = intParentDisplayOrder+1 objRs.Fields.Item("archives").Value = 0 objRs.Fields.Item("board").Value = intBoardID objRs.Fields.Item("groupname").Value = pstrName objRs.Fields.Item("description").Value = pstrDescription objRs.Fields.Item("allowpostings").Value = pblnAllowpostings objRs.Fields.Item("isRegistredPostingOnly").Value = pblnRegistredPostingOnly objRs.Fields.Item("readonly").Value = pblnReadOnly objRs.Fields.Item("hidden").Value = pblnHidden objRs.Fields.Item("isStrongModeration").Value = pblnStrongModeration call objRs.Update() intGroupID = GetNewID(pobjCon, objRs) objRs.Close set objRs = Nothing AddSubGroup = intGroupID call CommitTransaction(pobjCon, "AddSubGroup") else 'the parentgroup didn't exist objRs.close 'close the recordset NOT containing the parent group set objRs = Nothing AddSubGroup = -1 ' return error end if end function %>