Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why are my Command ActiveConnection Lines failing??

Status
Not open for further replies.

timfoster

Programmer
Dec 19, 2002
110
0
0
GB
I realise that the most common answer to this question is that I am using a constant without incluing the definition, but that isn't the case here. I also understand that it is likely to be a simple error that I can't see because I'm looking for something more complex, but here goes:

Every page of my code is now, suddenly, failing on the ActiveConnection with an error of 800a0bb9 "Arguments of the wrong type, or out of acceptable range"

The trouble is, the error is occuring on the line that sets the connection. So, my code (from the top) is:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<script language="VBSCRIPT" runat="server" src="vbs/vbadovbs.vbs"></script>
<script language="VBSCRIPT" runat="server" src="vbs/globalfunctions.vbs"></script>
<script language="VBSCRIPT" runat="server" src="vbs/connection.vbs"></script>
<%
Set cmd = CreateObject("ADODB.Command")

cmd.CommandType = adcmdStoredProc
cmd.CommandTimeout = 0
cmd.Prepared = True
cmd.ActiveConnection = "Driver={SQL Server};Server=ServerX;Database=dbX;UID=UserX;PWD=PasswordX;"
cmd.Parameters.Append cmd.CreateParameter("@RETURN_VALUE", adParamReturnValue, 4)
cmd.CommandText = "ValUser"
cmd.Execute


The error occurs on the line cmd.ActiveConnection = "Driver={SQL Server};Server=ServerX;Database=dbX;UID=UserX;PWD=PasswordX;"

I've tried using a connection string variable (in connection.vbs), putting the full string into the page, creating a connection object and using that, none of it works.

The unhelpful thing about it, is this worked on Wednesday when I was developing it. Yet, the next day it had stopped working. The exact same code also works fine from my webserver when connecting to a different database for my website), becuase I copied and pasted the connection as I always do.

Any help would be massively appreciated as this is starting to really nark me now!!!
 
After digging a bit more the problem seems to be because the connection string is in a separate file.

I've created a virgin page to test what's going on. If the connection is in the page, it works. If I put it in an include, it doesn't!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top