|
rdouglass -> RE: A better way? (3/11/2005 11:16:48)
|
Yes, IMO that would be easier in the long run, especially if these things change at all. If it was me, I'd put the stuff ina DB table and turn it into a function. It looks like you have a lot of "common ground" in the file path structure so you may want to turn it into a constant. Maybe something along the lines of this: <%DIM myMainPath myMainPath = "file://RLTLHNAS1/Images/Estate_Master_Files/503/" FUNCTION buildDropdown(parameter) 'Change mySQL to fit your table mySQL = ("SELECT id,filePath FROM myTable") set conntemp=server.createobject("adodb.connection") 'Need to have myDSN defined for your environment conntemp.open myDSN set rstemp=conntemp.execute(mySQL) IF rstemp.eof THEN response.write ("ERROR :NO dropdown stuff in " & userSQL) rstemp.close set rstemp=nothing conntemp.close set conntemp=nothing ELSE ddArray=rstemp.getrows rstemp.close set rstemp=nothing conntemp.close set conntemp=nothing Response.write("<select name='url' size='1'>" & VbCrLf & "<option>Select a Folder</option>") FOR i = 0 To ubound(ddArray,2) Response.write("<option value='" & myMainPath & ddArray(1,i) & "'" IF parameter = (myMainPath & ddArray(1,i)) THEN Response.write(" selected") END IF Response.write(">" & myMainPath & ddArray(1,i) & "</option>" & VbCrLf) NEXT Response.write("</select>" & VbCrLf) END IF END FUNCTION%> Then for you to call the dropdown function, you could do something like this: <%=buildDropdown(FpTemp)%> Haven't tested any of this code for syntax, but that's basically how I do it all the time. Hope it helps.
|
|
|
|