VB Script Error

I get the following error which I am not  able to figure out. Can any body tell me why this error message. I am working on personal web server.
Error Message
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'open'

/dblinking.asp, line 16

My code is posted below.

<% @ Language=VBScript %>

<% Response.Buffer = true %>  


<!--#include file="adovbs.asp"-->

<%

dim Cmd1,Cmd2
dim mydb1,mydb2
set Cmd1 = Server.CreateObject("ADODB.Command")
 mydb1 = "DSN=listtables;uid=scott; pwd =tiger"
 Cmd1.open mydb1
 
 set Cmd2 = Server.CreateObject("ADODB.Command")
 mydb2 = "DSN=classifieddata;uid=scott; pwd =tiger"
 Cmd2.open mydb2
 
 
'oCmd1.CommandType = adCmdText
 'oCmd1.Prepared = true
dim my_sqlquery1,sessionitem,sessionquantity
sessionitem = session("item")
sessionquantity = session("quantityintons")
my_sqlquery1 = "select sessionquantity from listing where item = sessionitem"
 Cmd1.execute(my_sqlquery1)
'oCmd1.CommandText = "my_sqlquery1"
 set Rs1 = server.CreateObject("ADODB.Recordset")
 Rs1.open my_sqlquery1, oCmd1,0
 'if  not oRs1.EOF then       
 'Rs1.MoveFirst  
 'end if
 'on db2
' oCmd2.CommandType = adCmdText
dim my_sqlquery2
my_sqlquery2 = "select sum(quantityintons) from getdatafrombids where item = sessionitem"
'oCmd2.Prepared = true
 'oCmd2.CommandText = "my_sqlquery2"
 Cmd2.execute(my_sqlquery2)
 set Rs2 = server.CreateObject("ADODB.Recordset")
 Rs2.open my_sqlquery2, Cmd2,0
 'if  not oRs1.EOF then       
'oRs2.MoveFirst
'end if



 dim var1, var2
 var1 = oRs1.fields.Item("quantityintons").value
 var2 = oRs2.fields.Item("quantityintons").value  
 
 
if var1 = var2 then

my_sqlquery1 = " update listing set quantityintons = var1-var2 where item = sessionitem"
Cmd1.Execute(my_sqlquery1)
elseif var1>var2 then  

my_sqlquery1 = " update listing set quantityintons = var1-var2 where item = sessionitem"
Cmd1.Execute(my_sqlquery1)
 else

my_sqlquery1 = "update listing set quantityintons = 0 where item = sessionitem"
Cmd1.Exceute(my_sqlquery1)
end if
%>



<%
oRs1.close
set oRs1 = nothing
oRs2.close
set oRs2 = nothing
oCmd1.close
set oCmd1 = nothing
oCmd2.close
set oCmd2 = nothing
%>
ramani081399Asked:
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.

TTomCommented:
The ADODB Command object does not support the "open" method.  It does, however, support "Execute".  I think you need to change your code above to:

Set Cmd1 = server.createobject("ADODB.Connection"), etc.
0

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
TTomCommented:
Actually, I was a bit hasty (hit the wrong button).

You will need a connection object AND a command object.  You use the command object later in the code, but you still need a separate connection object.

Tom
0
ramani081399Author Commented:
TTOM,

 Yes I realized as soon as I posted the query. Yes it works ok now. Thanks for your help.
Ramani
0
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
ASP

From novice to tech pro — start learning today.