Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to exec #include file

Status
Not open for further replies.

eirikr

Programmer
Oct 31, 2008
15
US
<%@ Language=VBScript %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns=" >
<head>
<title>Call file.asp from the database</title>
</head>
<body>
call_inc_file.asp calls hello.asp <br />
hello.asp contents: <!-- #include file="hello.asp" -->.OK HERE

<%

dim Conn
dim sql
dim ors

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "DSN=aaa; UID=bbb; PWD=ccc"
Conn.Open

sql = "select file_name from file_name_tbl"
Set ors = Conn.Execute(sql)

//use this if...else to catch exception
IF NOT ors.EOF THEN
ors.movefirst
do
'response.write(ors.Fields("file_name").value & "<br>")
%>
Expect to print file contents here: #include file="<%=ors.Fields("file_name").value%>" <br /> but it does not. WHAT SHOULD I DO TO EXEC THE INCLUDE FILE FROM HERE? TY FOR HELP

<%
ors.MoveNext
loop until ors.EOF

ors.Close
Set ors = nothing
Conn.close
Set Conn = nothing
END IF
%>
</body>
</html>
 
I'm not exactly sure what you are doing with the pseudocode so I can't give a full solution.

I think you will probably want to know about:

server.execute "somefile.asp
 
what BigRed said:

server.execute("<%=ors.Fields("file_name").value%>");

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
^ sorry: got js syntax mixed up in there....

<% server.execute(ors.Fields("file_name").value) %>

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top