Server.Execute problems

Results 1 to 2 of 2

Thread: Server.Execute problems

  1. #1
    Join Date
    Dec 1969

    Default Server.Execute problems

    I have one asp file I want to has a single function that creates a connection object and takes 5 parameters for the connection string.<BR><BR>When I call it with Server.Execute() in the other page, I get this error:<BR><BR>Error Type:<BR>Microsoft JScript runtime (0x800A138F)<BR>Object expected<BR>/index.asp, line 5<BR><BR>Here&#039;s the file being included:<BR><BR>/************************************************** *****<BR>* Routine that instantiates an ADO Connection object *<BR>* and opens it with a dsn-less connection string. The *<BR>* parameters provide the info for the dsn-less string. *<BR>********************************************* **********/<BR>function connDB(provider, dsource, icatalog, user, pass) {<BR> <BR> //dsn-less connection string<BR> var dsnlessStrConn = "Provider=" + provider + "; Data Source=" + dsource + ";" +<BR> "Initial Catalog=" + icatalog + "; User ID=" + user + "; Password=" + pass + ";"<BR> <BR> //try{} to instantiate the connection object<BR> try {<BR> var objConn = Server.CreateObject("ADODB.Connection");<BR> var isObj;<BR> with (objConn) {<BR> ConnectionString = dsnlessStrConn;<BR> Open();<BR> }<BR> <BR> if (typeof(objConn) == "object") {<BR> isObj = true;<BR> }<BR> else<BR> {<BR> isObj = false;<BR> }<BR> <BR> if (isObj == true) {<BR> return (true);<BR> }<BR> else<BR> {<BR> throw "objError";<BR> return (false);<BR> }<BR> <BR> }<BR> catch(exception) {<BR> if (exception == "objError") {<BR> Response.Write("object error!");<BR> }<BR> }<BR> return (objConn);<BR>}<BR><BR>Here&#039;s the page calling the file, the line calling the function is causing the error:<BR><BR>&#060;% <BR> Server.Execute("includes/ado_lib.asp"); <BR> connDB("SQLOLEDB", "", "dbname", "username", "pass");<BR>%&#062;<BR><BR>I&#039;m sure the path to the file is correct. If I try to include another file from the same directory that doesn&#039;t contain script it executes it just fine.<BR><BR>I know it&#039;s something dumb...I just don&#039;t want to spend another 2 hours staring at it!!<BR><BR>Thanks y&#039;awl!

  2. #2
    Join Date
    Dec 1969

    Default RE: Server.Execute problems

    this is on windows 2000 rather than NT4, right? does the file run right on it&#039;s own?<BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts