|
I used version MSSQL 7.96. Tested on a local computer, therefore the link I can not give. A problem that the following code adds in the table tblPermission data who are duplicated.
'Loop through each forum Do While intForumLoopCounter <= Ubound(iarryForumID,2) 'Reset permissions loop counter lngPermissionsLoopCounter = 0 'Loop through topics and to populate the topics table Do While lngPermissionsLoopCounter <= Ubound(iaryGroupID,2) 'Get the gorup ID 'See if a record exists for this group in the permissions table strSQL = "SELECT " & strDbTable & "Permissions.Group_ID " & _ "FROM " & strDbTable & "Permissions " & _ "WHERE " & strDbTable & "Permissions.Group_ID = " & CLng(iaryGroupID(0,lngPermissionsLoopCounter)) & " " & _ "AND " & strDbTable & "Permissions.Group_ID = " & CLng(iarryForumID(0,intForumLoopCounter)) & ";" 'Query the database rsCommon.Open strSQL, adoCon 'If no record is returned insert a new record in the database If rsCommon.EOF Then blnRead = strDBTrue If CLng(iaryGroupID(0,lngPermissionsLoopCounter)) = 2 Then blnPost = strDBFalse Else blnPost = strDBTrue 'not guest If CLng(iaryGroupID(0,lngPermissionsLoopCounter)) = 2 Then blnReply = strDBFalse Else blnReply = strDBTrue 'not guest If CLng(iaryGroupID(0,lngPermissionsLoopCounter)) = 2 Then blnEdit = strDBFalse Else blnEdit = strDBTrue 'not guest If CLng(iaryGroupID(0,lngPermissionsLoopCounter)) = 2 Then blnDelete = strDBFalse Else blnDelete = strDBTrue 'not guest If CLng(iaryGroupID(0,lngPermissionsLoopCounter)) = 1 Then blnPriority = strDBTrue Else blnPriority = strDBFalse 'Admin only blnPollCreate = strDBFalse blnVote = strDBFalse blnAttachments = strDBFalse blnImageUpload = strDBFalse blnCheckFirst = strDBFalse blnEvents = strDBFalse blnModerator = strDBFalse 'Insert values into database strSQL = "INSERT INTO [" & strDbTable & "Permissions] ( " strSQL = strSQL & "[Group_ID], " strSQL = strSQL & "[Forum_ID], " strSQL = strSQL & "[View_Forum], " strSQL = strSQL & "[Post], " strSQL = strSQL & "[Reply_posts], " strSQL = strSQL & "[Edit_posts], " strSQL = strSQL & "[Delete_posts], " strSQL = strSQL & "[Priority_posts], " strSQL = strSQL & "[Poll_create], " strSQL = strSQL & "[Vote], " strSQL = strSQL & "[Attachments], " strSQL = strSQL & "[Image_upload], " strSQL = strSQL & "[Moderate]" strSQL = strSQL & ") VALUES (" strSQL = strSQL & CLng(iaryGroupID(0,lngPermissionsLoopCounter)) & ", " strSQL = strSQL & CLng(iarryForumID(0,intForumLoopCounter)) & "," strSQL = strSQL & blnRead & "," strSQL = strSQL & blnPost & "," strSQL = strSQL & blnReply & "," strSQL = strSQL & blnEdit & "," strSQL = strSQL & blnDelete & "," strSQL = strSQL & blnPriority & "," strSQL = strSQL & blnPollCreate & "," strSQL = strSQL & blnVote & "," strSQL = strSQL & blnAttachments & "," strSQL = strSQL & blnImageUpload & "," strSQL = strSQL & blnModerator & ")" 'Write to the database adoCon.Execute(strSQL) End If 'Close recordset rsCommon.Close 'Move to next record lngPermissionsLoopCounter = lngPermissionsLoopCounter + 1 Loop 'Move to the next record intForumLoopCounter = intForumLoopCounter + 1 Loop End If
Accordingly the inquiry in lines default.asp 138-144 files superfluous data.
The code in lines of a file msSQL_server_update.asp works incorrectly. After performance of updating the total of records tblPermission in my database became 749. Before their updating there was 584!
------------- Чем дальше в лес, тем толще партизаны
|