944,149 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 2296
  • ASP RSS
Aug 12th, 2005
0

Is there anything wrong with this code

Expand Post »
<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.
Reputation Points: 10
Solved Threads: 0
Light Poster
wchitamb is offline Offline
31 posts
since Jul 2005
Aug 12th, 2005
0

Re: Is there anything wrong with this code

To include reusable code from a file you do smth like

functions.inc:
ASP Syntax (Toggle Plain Text)
  1. Function NewConn()
  2. Set NewConn= Server.CreateObject("ADODB.Connection")
  3. NewConn.ConnectionTimeout=100
  4. NewConn.Open "Provider=sqloledb;Data Source=[192.168.160.1];uid=[sa ];pwd=[topland]"
  5. NewConn.CommandTimeout=1200
  6. 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:
ASP Syntax (Toggle Plain Text)
  1. <HTML>
  2. <BODY>
  3. blahblah
  4.  
  5. <!--#include file="functions.inc"-->
  6.  
  7. <%
  8. more blah blah
  9. %>
  10. </BODY>
  11. </HTML>
Reputation Points: 10
Solved Threads: 5
Junior Poster
madmital is offline Offline
119 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: wat is web.config
Next Thread in ASP Forum Timeline: how to retrieve textfield for more than 1 checked records?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC