954,176 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Is there anything wrong with this code


<%


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

%>

wchitamb
Light Poster
31 posts since Jul 2005
Reputation Points: 10
Solved Threads: 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>
madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You