473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Include file issue

Why can't I get the following running???

<%
Dim GetODBCdsn
GetODBCdsn = <!--#include virtual="\connections\sqlconnection.txt" -->
Response.Write(GetODBCdsn)
%>

TIA,

Steve
Oct 27 '05 #1
5 1451
Steve Wofford wrote on 27 okt 2005 in
microsoft.public.inetserver.asp.general:
Why can't I get the following running???

<%
Dim GetODBCdsn
GetODBCdsn = <!--#include virtual="\connections\sqlconnection.txt" -->
includes cannot sit inside <% %> and [so] have no output.
Response.Write(GetODBCdsn)
%>


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 27 '05 #2
Because you are mis-using the #include tag. It's a client-side tag, not a
server side (you also cannot assign it to a var....)

If you want your var to hold the string(s) contained within the file, you
need to first open and read the file, THEN assign the string(s) to your var.

http://aspfaq.com/show.asp?id=2039

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Steve Wofford" <In*******@yahoo.com> wrote in message
news:#$**************@tk2msftngp13.phx.gbl...
Why can't I get the following running???

<%
Dim GetODBCdsn
GetODBCdsn = <!--#include virtual="\connections\sqlconnection.txt" -->
Response.Write(GetODBCdsn)
%>

TIA,

Steve

Oct 27 '05 #3
Steven Burn wrote on 27 okt 2005 in
microsoft.public.inetserver.asp.general:
Because you are mis-using the #include tag. It's a client-side tag, not a
server side (you also cannot assign it to a var....)


I strongly disagree, Steven.

<!--#include virtual="\blahDir\blahFile.asp" -->

is serverside

and can [and most often does in my case] contain ASP level code that is
executed inline with other asp code in the master file.

<%
a = 1
%>
<!--#include virtual="\adder.asp" -->
<% 'vbscript
response.write a
' this will write 2 to the rendered html output stream,
' if adder.asp contains <% a = a+1 %>
%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 27 '05 #4
hehe, I know, what I meant was, the #include tag itself is client-side (i.e.
cannot be encased in the <% %> tags), irrespective of what code the included
file does or does not have, it cannot be treat in the same manner.

Hope I'm making sense? (made sense to me whilst I was writing the
reply....lol (I knew what I meant anyway)).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Steven Burn wrote on 27 okt 2005 in
microsoft.public.inetserver.asp.general:
Because you are mis-using the #include tag. It's a client-side tag, not a server side (you also cannot assign it to a var....)


I strongly disagree, Steven.

<!--#include virtual="\blahDir\blahFile.asp" -->

is serverside

and can [and most often does in my case] contain ASP level code that is
executed inline with other asp code in the master file.

<%
a = 1
%>
<!--#include virtual="\adder.asp" -->
<% 'vbscript
response.write a
' this will write 2 to the rendered html output stream,
' if adder.asp contains <% a = a+1 %>
%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 27 '05 #5
#include is not part of VBScript but a server directive. Though you could
try %><!etc..><%, I don't find very clear to include "fragments". I would
rather include a file that contains a whole constant declaration :

<!--#include virtual="/somewhere/settings.inc"-->
<%
Response.Write ConnectionString
'My code
%>

Const ConnectionString="Whatever"
being in the settings.inc file...

Additonaly you'll be able to add other constants to this file if needed...
--

"Steve Wofford" <In*******@yahoo.com> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
Why can't I get the following running???

<%
Dim GetODBCdsn
GetODBCdsn = <!--#include virtual="\connections\sqlconnection.txt" -->
Response.Write(GetODBCdsn)
%>

TIA,

Steve

Oct 28 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Vojma | last post by:
I have a problem At my site I have designed a framework with tabs as below (tabs_1.asp) +----+ +------+ +-------+ | MC | | Cars | | Boats | + +------------------------- then, into...
8
by: Jonathan LaRosa | last post by:
Hi all - I would like to do something like this: <!--#include file="C:\dbutils\dbConfig.asp"--> Where the directory C:\dbutils is OUTSIDE of the web directory and not accessible by a client...
9
by: JR | last post by:
Hi, I'm migrating my website to an IIS 6.0 server and all the asp pages work fine except for the ones that reference include files, even though I have "Enable parent paths" enabled in the...
1
by: Des Perado | last post by:
We have an elderly DOS-based system running on a Novell Netware server here, and an extensive intranet. Quite recently the board decided that some crucial info from the DOS system was to be made...
9
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft...
2
by: Matt | last post by:
In ASP 3.0, we use <!-- #INCLUDE FILE="anotherfile.asp" --> But when I use it in ASP.NET, it failed to compile. I heard that I should use <%@ Page, or <%@Reference, but in the header of the...
10
by: Eric | last post by:
Hello, I have some server side includes on a Classic asp page that look something like: <!-- #include virtual="/includes/file1.asp"--> <!-- #include virtual="/includes/file2.asp" --> <!--...
10
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
10
by: Raheem | last post by:
Hello, I built a development version of a live website on my hosted account. However the development version is having problems with finding include files. After troubleshooting I was able to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.