PDA

Click to See Complete Forum and Search --> : #include file using a variable for the filename


Dr_Evil
Dec 19th, 2000, 11:09 AM
I would like to know if it is possible to include a file by passing a variable. I am pulling the location of the files from a SQL Server DB. Everything works except for the #include.

Ex.

<%
Private Function CreateTable(Col1Width, Col2Width, Col3Width, Height)
Dim objRS
Dim objStatus
Dim objDescriptionLocation

Set objRS = GetPresidentsPickByDate (1, 2001)

For i = 1 to 4
If objRS.Fields(11).Value = 0 Then
objStatus = "Backorder"
Else
objStatus = "In Stock"
End If

objDescriptionLocation = objRS("Descriptionlocation")

Response.Write "<tr>" & vbCRLF
Response.Write "<td width='" & Col1Width & "' height='" & Height & "'><img border='0' src= " & objRS("GIFLocation") & " width='188' height='166'></td>" & vbCRLF
Response.Write "<td width='" & Col2Width & "' height='" & Height & "'><!-- #include file='" & objDescriptionLocation & "' -->" & vbCRLF
Response.Write "<td width='" & Col3Width & "' height='" & Height & "'><p align='center'><b>'" & objStatus & "'</b></p>" & vbCRLF
Response.Write "</td>" & vbCRLF
Response.Write "</tr>" & vbCRLF

objRS.MoveNext
Next
End Function
%>

kovan
Dec 19th, 2000, 12:32 PM
give this a shot

<%
dim var
var = "myfile.txt"
%>
<!--#include file="<%=var%>"-->