[Windows] Help needed script will not run.
Posted: September 30th, 2008, 2:48 am
Hi everyone, I am hoping someone can help me. I Have written a VBS script which takes command line arguments and then uses these as the values for an SQL insert statement. Running this from command prompt as; cscript sabnzbd.vbs one two three four will then use the values one, two, three, four. So with this in mind a made a text file which says
However when I run this script it just hangs and in the history says "running script c:\sabnzbd.txt" and never works. Has anyone got any ideas what I am doing wrong.
Here is the VBS
]
Code: Select all
cscript C:\xsabnzbd.vbs %4 %3 %6 %1Here is the VBS
Code: Select all
Dim OdbcDSN
Dim connect, sql, resultSet
strNewzbinID = WScript.Arguments.Item(0)
strItemName = WScript.Arguments.Item(1)
strNewsGroup = WScript.Arguments.Item(2)
strFile_path = WScript.Arguments.Item(3)
OdbcDSN = "DSN=relnet;UID=dba;PWD=sql"
Set connect = CreateObject("ADODB.Connection")
connect.Open OdbcDSN
sql="INSERT INTO tvshow (tvshow_ref, show_name, file_path, Groups) VALUES ('" & strNewzbinID & "','" & strItemName & "', '" & strFile_path & "', '" & strNewsGroup & "');commit"
Set resultSet = connect.Execute(sql)
On Error Resume Next
resultSet.MoveFirst
resultSet.Close
connect.Close
Set connect = Nothing
WScript.Quit(0)