0

<html>
<head>
<title></title>
</head>
<body>
<%


Function NewConn()
Set NewConn= Server.CreateObject("ADODB.Connection")
NewConn.ConnectionTimeout=100
NewConn.Open "Provider=sqloledb;Data Source=[192.168.160.1];uid=[sa ];pwd=[topland]"
NewConn.CommandTimeout=1200
End Function

%>
</body>
</html>

I am trying this functions.inc code then use the include ext and i keep on getting this error message

Error Type:
Active Server Pages, ASP 0126 (0x80004005)
The include file 'functions.inc' was not found.
/Assets.asp, line 1

and when i try to save it as functions.inc.asp i get this

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Staff.asp, line 14, column 37

i am relly stuck and have been going around for days nows can anyone please help.

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by madmital
0

To include reusable code from a file you do smth like

functions.inc:

Function NewConn() 
Set NewConn= Server.CreateObject("ADODB.Connection")
NewConn.ConnectionTimeout=100
NewConn.Open "Provider=sqloledb;Data Source=[192.168.160.1];uid=[sa ];pwd=[topland]"
NewConn.CommandTimeout=1200
End Function

And then in the file where you want to insert the 'functions.inc' (the file should have the '.asp' extension)
eg. index.asp:

<HTML>
<BODY>
blahblah

<!--#include file="functions.inc"-->

<%
more blah blah
%>
</BODY>
</HTML>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.