tags:

views:

66

answers:

2

Hey, I am trying to use ASP to create a connection to my database and i have the following connection code:

Set objConn = ConnectDB()
Set objRS   = objConn.Execute(query)

I have an include file that I have at the top of my page:

<!--#include FILE=dbcano.inc-->

And I get this error when I call my page:

Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'ConnectDB' patti_trinkets.asp, line 9

The ConnectDB() is a function I created that is stored within the dbcano.inc file.

Any suggestions as to why I am getting this error when I call my page?

My full code can be found here: http://pastie.org/337183

Thank you,

Ryan

A: 

Shouldn't you try

ConnectDB(objConn)

instead?

Eric
How can you tell what parameters ConnectDB takes without seeing the source code?
Jim Anderson
A: 

Well. It finds the include file because you dont get the

"Active Server Pages error 'ASP 0126'

Include file not found The include
file 'dbcano.inc' was not found

But your function ConnectDB that I presume should return a connection object is not recognized as a function, therefore it thinks it is a undefined variable.

To know why, we really need to se the code in the include file too.

And by the way, make sure to stop your server to serve the content in the .inc -file. Too many times, you see sites where the inc-file has been moved, and some old page serves up the "Include file not found. The include file "dbhandler.inc" was not found" and then you only have to enter dbhandler.inc in the browser to get the sql-server name/ip, connectionstring and everything. This is well known but still a common thing, just google the error message with a couple of more keywords to get a list of exploitable sites.

Stefan