C
Colin Graham
Im working on some asp code using vbscript but i cant seem to get the
following code to work. I can get the result from the database but im
having to joy returning the value to the html code in order to open a
specific document. any help appreciated.
I dont get an error message but i get a blank screen. The problem
seems to be with the Return Value of the function - i may not be using
this correctly.
<td>
<%Response.write(GetPDFPath())%>
</td></form>
</TABLE>
</form>
</body></TR></TBODY></TABLE></FORM>
<%
Function GetPDFPath()
Dim oRS, strSQL, txt_ClientCode, strPDFName
dim pdfname
txt_ClientCode = "AA3"
If len(txt_ClientCode)>0 Then
strSQL = "Select ClientCode, PDFName From tbl_PaymentProtectionPDF
Where ClientCode = '" & txt_ClientCode & "'"
Set oRS = Server.CreateObject("ADODB.RecordSet")
on error resume next
oRS.Open strSQL,Application("ConnectionString"),adOpenKeyset,adLockBatchOptimistic
if err.number <> 0 then
response.write "Error: " & err.description
response.end
end if
If Not (oRS.EOF And oRS.BOF) Then
oRS.MoveFirst
strPDFName = oRS(1).value
GetPDFPath = "<iframe height=100% width=100% frameborder=no
src=http://" & Request.ServerVariables("SERVER_NAME") &
"/OAD_XML/documents/" & strPDFName & ".pdf" & " </iframe>"
oRS.Delete
oRS.Update
end if
oRS.Close
Set oRS = Nothing
Response.End
End If
End Function
%>
</BODY>
</HTML>
following code to work. I can get the result from the database but im
having to joy returning the value to the html code in order to open a
specific document. any help appreciated.
I dont get an error message but i get a blank screen. The problem
seems to be with the Return Value of the function - i may not be using
this correctly.
<td>
<%Response.write(GetPDFPath())%>
</td></form>
</TABLE>
</form>
</body></TR></TBODY></TABLE></FORM>
<%
Function GetPDFPath()
Dim oRS, strSQL, txt_ClientCode, strPDFName
dim pdfname
txt_ClientCode = "AA3"
If len(txt_ClientCode)>0 Then
strSQL = "Select ClientCode, PDFName From tbl_PaymentProtectionPDF
Where ClientCode = '" & txt_ClientCode & "'"
Set oRS = Server.CreateObject("ADODB.RecordSet")
on error resume next
oRS.Open strSQL,Application("ConnectionString"),adOpenKeyset,adLockBatchOptimistic
if err.number <> 0 then
response.write "Error: " & err.description
response.end
end if
If Not (oRS.EOF And oRS.BOF) Then
oRS.MoveFirst
strPDFName = oRS(1).value
GetPDFPath = "<iframe height=100% width=100% frameborder=no
src=http://" & Request.ServerVariables("SERVER_NAME") &
"/OAD_XML/documents/" & strPDFName & ".pdf" & " </iframe>"
oRS.Delete
oRS.Update
end if
oRS.Close
Set oRS = Nothing
Response.End
End If
End Function
%>
</BODY>
</HTML>