Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 the command script does not destroy all the object

Author  Topic 

squarefish
Starting Member

28 Posts

Posted - 2010-08-16 : 06:18:53
The code below works fine as a vbs file, but when I try and use it as an active x script within sql2005 I get the above error saying not all the objects were destroyed???

as far as I can see all my set something = have a set something = nothing?

Any ideas?

[CODE]option explicit

dim MM_stock_STRING, MM_CAP_STRING, MM_CAP2_STRING, rs, regplate, capid, rsCap, sql, manufacturer
dim range, derivative, fueldelivery, drivetrain, transmission, doors, bodystyle, optionActual
dim MM_editCmd, rsCap2


'get all cars with a cap id
set rs = CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_stock_STRING
rs.Source = mysql
rs.CursorType = 2
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

'Loop through the cars
do until rs.EOF
set rsCAP = CreateObject("ADODB.Recordset")
rsCAP.ActiveConnection = MM_CAP_STRING
sql = mysql

rsCAP.Source = sql
rsCAP.CursorType = 2
rsCAP.CursorLocation = 2
rsCAP.LockType = 1
rsCAP.Open()

if not rsCAP.EOF then


'write results back to db
Set MM_editCmd = CreateObject("ADODB.Command")
sql = mysql
MM_editCmd.ActiveConnection = MM_stock_STRING
MM_editCmd.CommandText = sql
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Set MM_editCmd = NOTHING
'reset optionActual
optionActual=""
else

set rsCAP2 = CreateObject("ADODB.Recordset")
rsCAP2.ActiveConnection = MM_CAP2_STRING
sql = sql
rsCAP2.Source = sql
rsCAP2.CursorType = 2
rsCAP2.CursorLocation = 2
rsCAP2.LockType = 1
rsCAP2.Open()

'loop through the optionActual and append to string
if not rsCAP2.EOF then


'write results back to car
Set MM_editCmd = CreateObject("ADODB.Command")
sql = mysql
MM_editCmd.ActiveConnection = MM_stock_STRING
MM_editCmd.CommandText = sql
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Set MM_editCmd = Nothing
optionActual=""
else
'delete and alert
Set MM_editCmd = CreateObject("ADODB.Command")
sql = mysql
MM_editCmd.ActiveConnection = MM_stock_STRING
MM_editCmd.CommandText = sql
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Set MM_editCmd = Nothing
end if
rsCAP2.Close()
SET rsCAP2 = Nothing
end if
rsCAP.Close()
SET rsCAP = Nothing
rs.MoveNext
Loop

rs.Close
set rs=nothing

[/CODE]

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-08-16 : 10:15:20
http://connect.microsoft.com/SQLServer/feedback/details/284448/the-command-script-does-not-destroy-all-the-objects-that-it-creates-revise-the-command-script-error-14277
Go to Top of Page
   

- Advertisement -