This is a biggy! I need it quick... and appreciate any help.
K, I got this page which dynamically lists/shows a number of images. There are 2 options to be set for each image. Whether or not it is shown (HIDE) and what sequence it should be shown in (SORT). Sometimes a job has as many as 500 images.
When the studio (Photographer) goes on and makes changes, to all of the images, my script goes, sees if the options has changed and if it has, updates the database. I am wondering, should I open and close the database for each change? Or can I open it and leave it... here is the code I have right now. Please, any questions, let me know. I kinda gotta work this out soon.
RecSelect("SELECT ID, Sort, Hide FROM Photos WHERE JobNumber LIKE '" & job & "' ORDER BY Sort"
aRecSet = recSet.GetRows '-->I built this into an array, so I don't have 2 connections to the database at the same time.
If Err.number <> 0 then
TrapError "GetRows Line 23", Err.number, Err.Source, Err.description, bsktNum
End If
RecClose
x = UBound(aRecSet, 1)
y = UBound(aRecSet, 2)
j = 0
'Response.Write x & ", " & y
for j = 0 to y
' --> Checking to see if the Sort is different. If it is, change it.
varElement = "sort" & aRecSet(0,j)
RecUpdate "Photos"
if NOT CInt(Request.Form(varElement)) = aRecSet(1,j) then
batchSet.Find "ID = '" & aRecSet(0,j) & "'"
batchSet("Sort"
= CInt(Request.Form(varElement))
end if
' --> Checking to see if the Hide is different. If it is, change it.
if Request.Form(varElement) = "on" then '-->This is a checkbox, so I need to change the value from on to TRUE.
tempVar = True
else
tempVar = False
end if
if NOT tempVar = aRecSet(2,j) then
batchSet.Find "ID = '" & aRecSet(0,j) & "'"
batchSet("Hide"
= tempVar
end if
BatchClose
Next
ProcessErrors '-->A function I have created to mail me any errors.
Response.Redirect "imageAdmin.asp?Job=" & job & "&jobID=" & jobID 'this is where the code sends the person to next.
K, I got this page which dynamically lists/shows a number of images. There are 2 options to be set for each image. Whether or not it is shown (HIDE) and what sequence it should be shown in (SORT). Sometimes a job has as many as 500 images.
When the studio (Photographer) goes on and makes changes, to all of the images, my script goes, sees if the options has changed and if it has, updates the database. I am wondering, should I open and close the database for each change? Or can I open it and leave it... here is the code I have right now. Please, any questions, let me know. I kinda gotta work this out soon.
RecSelect("SELECT ID, Sort, Hide FROM Photos WHERE JobNumber LIKE '" & job & "' ORDER BY Sort"
aRecSet = recSet.GetRows '-->I built this into an array, so I don't have 2 connections to the database at the same time.
If Err.number <> 0 then
TrapError "GetRows Line 23", Err.number, Err.Source, Err.description, bsktNum
End If
RecClose
x = UBound(aRecSet, 1)
y = UBound(aRecSet, 2)
j = 0
'Response.Write x & ", " & y
for j = 0 to y
' --> Checking to see if the Sort is different. If it is, change it.
varElement = "sort" & aRecSet(0,j)
RecUpdate "Photos"
if NOT CInt(Request.Form(varElement)) = aRecSet(1,j) then
batchSet.Find "ID = '" & aRecSet(0,j) & "'"
batchSet("Sort"
end if
' --> Checking to see if the Hide is different. If it is, change it.
if Request.Form(varElement) = "on" then '-->This is a checkbox, so I need to change the value from on to TRUE.
tempVar = True
else
tempVar = False
end if
if NOT tempVar = aRecSet(2,j) then
batchSet.Find "ID = '" & aRecSet(0,j) & "'"
batchSet("Hide"
end if
BatchClose
Next
ProcessErrors '-->A function I have created to mail me any errors.
Response.Redirect "imageAdmin.asp?Job=" & job & "&jobID=" & jobID 'this is where the code sends the person to next.