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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TTomConnect With a Mentor Commented:
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
 
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
All Courses

From novice to tech pro — start learning today.