Problem with includes. (ASP)

I have a page that calls a database connection. The code below works fine.

'Specify the connection string to access the database.
'Remember to change the following connection string parameters to reflect the correct values
'for your SQL server.
StrConnect = "dsn=bluedotrw;uid=bluedotrw;pwd=lotus99minyu2015!@;"

Open in new window

I am trying to replace that connection with an include file. I tried doing:

'Specify the connection string to access the database.
'Remember to change the following connection string parameters to reflect the correct values
'for your SQL server.

<!--#include file="../Connections/bdotbformsread.asp"-->

Open in new window

The include file is an asp that has 1 line of code:

StrConnect = "dsn=bluedotrw;uid=bluedotrw;pwd=lotus99minyu2015!@;"

Open in new window

I would think that would work but I get an error.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/bluedot/blueforms/validate.asp, line 42

Which is where that line is. The path is correct and the connection string is the same. Perhaps the syntax in the include is wrong ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom ChadaraviciusSenior DeveloperCommented:
To check if the included file is really included, can you try Response.Write([StrConnect]) (replace the [StrConnect] with a string variable from the file your are including)?
Rainer JeschorCommented:
error code 80004005 means normally "Access denied".
I guess that in your IIS configuration parent paths are disabled, hence your include file cannot be loaded as it is referenced relatively "../"

Could you try to reference it full qualified OR move the file one Folder down?

AleksAuthor Commented:
How should the reference be so that I don't have to turn parent paths on?
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

AleksAuthor Commented:
Also that can't be the issue because I have a lot of include files and none have this issue. So parent paths is already on.
AleksAuthor Commented:
I tried the response.write but I keep getting the error.
Parent paths is ON.

Here is the entire page code:

<!DOCTYPE html>

<!--#BlueDot Include files-->
<!--#include file="../includes/bdot/EnDe.asp"-->
<!--#include file="../includes/bdot/Validates.js"-->


'The following three lines of code are used to make sure that this page is not cached on the client.
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

Dim userid
Dim Pwd

'Assign the user ID to this variable. The user provides the user ID.
userid= Request("UID")
'Check whether userid is an empty string. If it is empty, redirect to Logon.asp.
'If it is not empty, connect to the database, and validate the user.

if userid <> "" then
    pwd = EncrytPswd(Request("passwd"))
    Dim Cn
    Dim RsOne
    Dim StrConnect
	Dim id

'Specify the connection string to access the database.
'Remember to change the following connection string parameters to reflect the correct values
'for your SQL server.
 <!--#include file="../Connections/bdotbformsread.asp"-->
       Set Cn = Server.CreateObject("ADODB.Connection")
    Cn.Open StrConnect
   SQL = "Select id , code1 , code2 , firmid , caseid from blueformsemailed where code1='" & userid & "' AND code2 = '" & pwd & "'"
   ' response.Write SQL
   ' response.end
   Set RS = Cn.Execute(SQL)
   If RS.EOF Then
    'login name not found or incorrect login
    response.Redirect "login_error.asp"
     Session("UID") = userid
	 Session("Pwd") = Pwd
     Response.Redirect "default.asp"
   End If
End If

<meta charset="utf-8">
<title>Untitled Document</title>



Open in new window

The included file is above.
Big MontySenior Web Developer / CEO of Commented:
first of all, I would recommend editing your original post and take out your username and password for security reasons :)

i don't think it's a path issue as you would get an error stating the file to be included can't be found.

on line 37 above, you make the call for the include file, yet you have it within <% %> tags, which you cannot do.  instead, move it with your other include files:

<!--#BlueDot Include files-->
<!--#include file="../includes/bdot/EnDe.asp"-->
<!--#include file="../includes/bdot/Validates.js"-->
<!--#include file="../Connections/bdotbformsread.asp"-->

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
Ha! .. thanks .. obviously I was too tired. I can't edit the original post apparently. But its just a temporary user and password that are local to my desktop.

Well .. that worked so ... this is the correct answer.
I was just telling my friend that every time you answer a question you get it right  :)  
Thanks ... again and again ...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.