?
Solved

Problem with connection string

Posted on 2011-10-23
15
Medium Priority
?
187 Views
Last Modified: 2012-05-12
I'm trying to use a driver connection string to open the connection to my database.
The first time I load the page I get this error:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
I am getting this on the .activeconnection line.

I don't see anything wrong with my code, so I go back to my page and hit F5, and the page loads properly.

What am I doing wrong?
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
MM_donorSelect_app1 = "DRIVER={SQL Server};Server=8888;Database=8888;Uid88888;Pwd=888888;"
MM_CMS_STRING = stringUse

Recordset1_cmd.ActiveConnection = MM_CMS_STRING

Recordset1_cmd.CommandText = "SELECT * FROM eventsQ" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0

Open in new window

0
Comment
Question by:rivkamak
  • 5
  • 5
  • 4
  • +1
15 Comments
 
LVL 9

Expert Comment

by:raysonlee
ID: 37015836
"=" sign missing after Uid?
0
 

Author Comment

by:rivkamak
ID: 37015838
no, sorry, it just got erased when I took out the real number
0
 
LVL 9

Expert Comment

by:raysonlee
ID: 37015864
Use Provider=MSDASQL to replace DRIVER={SQL Server} or simply remove it as it is the default.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Expert Comment

by:Eyal
ID: 37016005
you will find your answer here
http://www.connectionstrings.com/
0
 
LVL 5

Expert Comment

by:sebastienbo
ID: 37016960
dim strSQL
set Global_DBConnection=Server.CreateObject("ADODB.Connection")
DSN="Driver={SQL Server};Server=000.000.000.000;Database=DATABASENAME;UID=USERNAME;PWD=PASSWORD"
Global_DBConnection.Open(DSN)
0
 

Author Comment

by:rivkamak
ID: 37018365
You are all missing the question.
I have that string correct in my script.
When you load the page the first time, you get this error:

ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

But if you hit refresh the page loads properly.

Why the first time around am I hitting an error, yet, my code does work properly the second time?
0
 

Author Comment

by:rivkamak
ID: 37022053
sebastienbo-
based on your answer of changing the script to .open,

how do I continue making a recordset?


Recordset1_cmd.ActiveConnection = MM_CMS_STRING
Recordset1_cmd.CommandText = "SELECT * FROM eventsQ"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
0
 
LVL 15

Expert Comment

by:Eyal
ID: 37022323
not sure it will solve something but...

Set Recordset1 = Recordset1_cmd.Execute()
0
 
LVL 9

Expert Comment

by:raysonlee
ID: 37028814
0
 

Author Comment

by:rivkamak
ID: 37029092
That last example won't work for me. I'm using straight ASP not ASP.NET
What else might solve this error message?

ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
0
 
LVL 15

Expert Comment

by:Eyal
ID: 37029333
how do you know it fails in this statement and not other?
put response.end before the execute
press F5
if you don't get an error move it after the execute and press again F5
do you get the error now?
0
 
LVL 9

Expert Comment

by:raysonlee
ID: 37029349
0
 
LVL 9

Expert Comment

by:raysonlee
ID: 37029355
Details about the error code: http://support.microsoft.com/kb/254517/en-us
0
 

Author Comment

by:rivkamak
ID: 37032065
This is the entire list of code.

this line is the line of error i'm getting:
Recordset1_cmd.ActiveConnection = MM_CMS_STRING

<%
  openConnection = false
MM_donorSelect_app1 = "DRIVER={SQL Server};Server=***.***.***.***;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"
MM_donorSelect_app2 = "DRIVER={SQL Server};Server=***.***.**.**;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"
MM_donorSelect_app3 = "DRIVER={SQL Server};Server=**.**.***.***;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"

Dim ADOErrors, ADOError

Set myConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
myConn.open MM_donorSelect_app1
Set ADOErrors = myConn.Errors
On Error GoTo 0

If ADOErrors.Count = 0 then
	If myConn.State = 1 then 

		stringUse = MM_donorSelect_app1
		openConnection = true

	End If
End If

'try connection 2
if openConnection = false then
	Dim ADOErrors2, ADOError2

Set myConn2 = Server.CreateObject("ADODB.Connection")
On Error Resume Next
myConn2.open MM_donorSelect_app2
Set ADOErrors2 = myConn2.Errors
On Error GoTo 0

If ADOErrors2.Count = 0 then
	If myConn2.State = 1 then 

		stringUse = MM_donorSelect_app2
		openConnection = true
	End If

End If


end if ' check connection
'
if openConnection = false then
	Dim ADOErrors3, ADOError3

Set myConn3 = Server.CreateObject("ADODB.Connection")
On Error Resume Next
myConn3.open MM_donorSelect_app3
Set ADOErrors3 = myConn3.Errors
On Error GoTo 0

If ADOErrors3.Count = 0 then
	If myConn3.State = 1 then 
		stringUse = MM_donorSelect_app3
		openConnection = true
	End If
End If
end if ' open connection

MM_CMS_STRING = stringUse

%>

<%

Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")

Recordset1_cmd.ActiveConnection = MM_CMS_STRING
Recordset1_cmd.CommandText = "SELECT * FROM eventsQ" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

Open in new window

0
 
LVL 15

Accepted Solution

by:
Eyal earned 2000 total points
ID: 37036226
try this
<%
  openConnection = false
MM_donorSelect_app1 = "DRIVER={SQL Server};Server=***.***.***.***;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"
MM_donorSelect_app2 = "DRIVER={SQL Server};Server=***.***.**.**;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"
MM_donorSelect_app3 = "DRIVER={SQL Server};Server=**.**.***.***;Database=OorahCMS;Uid=CMS-Oorah;Pwd=800spring;"

Dim ADOErrors, ADOError

Set myConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
myConn.open MM_donorSelect_app1
Set ADOErrors = myConn.Errors
On Error GoTo 0

If ADOErrors.Count = 0 then
	If myConn.State = 1 then 
		openConnection = true
	End If
End If

'try connection 2
if openConnection = false then
	Dim ADOErrors2, ADOError2

	On Error Resume Next
	myConn.open MM_donorSelect_app2
	Set ADOErrors = myConn.Errors
	On Error GoTo 0

	If ADOErrors.Count = 0 then
		If myConn.State = 1 then 
			openConnection = true
		End If
	End If

end if ' check connection
'
if openConnection = false then

	On Error Resume Next
	myConn.open MM_donorSelect_app3
	Set ADOErrors = myConn.Errors
	On Error GoTo 0

	If ADOErrors.Count = 0 then
		If myConn.State = 1 then 
			openConnection = true
		End If
	End If
end if ' open connection

MM_CMS_STRING = stringUse

Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")

Recordset1_cmd.ActiveConnection = myConn
Recordset1_cmd.CommandText = "SELECT * FROM eventsQ" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question