473,385 Members | 1,912 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,385 software developers and data experts.

Syntax Error on 'Sub mysub()' Include File

I know this is simple but I'm new with it and can't see it. I am
calling this sub from an ASP page right after the
<html> tag as:
<!-- #include file="genproc.inc"-->

Then I call the sub below in the asp in the validate routine to 'Call
ConnectDB'

The connection itself is okay.

But, the page will not even display, I get a syntax error on the 'Sub
Connect()' line of this file (include file) :
------------------------
<html>
<head>
</head>
<body>
<%
Sub ConnectDB()
' Database Connection
Dim sConn, dcn
sConn = "Provider=SQLOLEDB; " & _
"Data Source=nnn.nnn.nnn.nnn\ServerName; " & _
"Database=theDB; " & _
"User ID=aUser; " & _
"Password=aUserPW;"
Set dcn = Server.CreateObject("ADODB.Connection")
dcn.ConnectionString = sConn
dcn.Open
End Sub
%>
</body>
</html>
-------------------

SusanC

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
1 1579
Susan Cranford wrote:
I know this is simple but I'm new with it and can't see it. I am
calling this sub from an ASP page right after the
<html> tag as:
<!-- #include file="genproc.inc"-->

Then I call the sub below in the asp in the validate routine to 'Call
ConnectDB'

The connection itself is okay.

But, the page will not even display, I get a syntax error on the 'Sub
Connect()' line of this file (include file) :
------------------------
<html>
<head>
</head>
<body>
<%
Sub ConnectDB()
' Database Connection
Dim sConn, dcn
sConn = "Provider=SQLOLEDB; " & _
"Data Source=nnn.nnn.nnn.nnn\ServerName; " & _
"Database=theDB; " & _
"User ID=aUser; " & _
"Password=aUserPW;"
Set dcn = Server.CreateObject("ADODB.Connection")
dcn.ConnectionString = sConn
dcn.Open
End Sub
%>
</body>
</html>
-------------------

Get rid of the html tags in this page. Only include the server-side script
block.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2

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

Similar topics

8
by: Tim | last post by:
Here is a description of my problem... call mysub (5, 10) sub mysub (valA, valB) response.write valB valA = valA - 1 response.write valB end sub
4
by: AndrewM | last post by:
Hello, I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ? for i=0 to 100 call mySub(arr(0,i)) next
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
3
by: Fabio | last post by:
Hi all, Whats the real difference between Overloads and Shadows in a Sub???? Thanks in advance, Fabop
1
by: timbobd | last post by:
I have encountered a situation that I don't understand. When I call a sub of Friend scope (in an object with Friend scope), I am getting an error "Public member 'subname' not found in type...
16
by: Mark | last post by:
Hello. I am attempting to use AppendChunk() to write binary data to a memo field in Access 2000. My initial call to AppendChunk() results in a data type conversion error. Any suggestions? Here...
0
by: sam.s.kong | last post by:
Hi! When I create or modify an asp file, obvious systax errors are not detected. For example: Sub MySub Response.Write "Hello" End
6
by: tgnelson85 | last post by:
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.