I have a script that updates records in a DB and I want to know how many rows were updated when the script is done. Where and what do I need to add to this script to accomplish that?
Dim db
db = InputBox("Enter the database name you want to update."
'Create Connection
set con = CreateObject("ADODB.Connection"
strCon = "driver={SQL SERVER};server=COPPER;uid=hsi;pwd=mypw;database=" & db & ""
con.Open strCon
'Create Command
set doit = CreateObject("ADODB.Command"
set doit.ActiveConnection = con
sql = "UPDATE hsi.useraccount " & _
"SET userpref2 = 8415465 " & _
"WHERE userpref2 = 8413413 "
set rs = CreateObject("ADODB.Recordset"
rs.Open sql, con
wscript.echo "Users updated for " & db &""
set con = nothing
set doit = nothing
wscript.quit
Dim db
db = InputBox("Enter the database name you want to update."
'Create Connection
set con = CreateObject("ADODB.Connection"
strCon = "driver={SQL SERVER};server=COPPER;uid=hsi;pwd=mypw;database=" & db & ""
con.Open strCon
'Create Command
set doit = CreateObject("ADODB.Command"
set doit.ActiveConnection = con
sql = "UPDATE hsi.useraccount " & _
"SET userpref2 = 8415465 " & _
"WHERE userpref2 = 8413413 "
set rs = CreateObject("ADODB.Recordset"
rs.Open sql, con
wscript.echo "Users updated for " & db &""
set con = nothing
set doit = nothing
wscript.quit