Jump to content

Microsoft VBScript runtime error: Object required: 'Wscript'


Akasha

Recommended Posts

Hello i am new with vbscriptFirst let me tell you what i am trying to do.I want to pass arguments into my script and use these to update a record in a database.When i run my script i get the following error Microsoft VBScript runtime error: Object required: 'Wscript'.below is my script (still a test not the final)

dim command_line_argsset command_line_args = Wscript.ArgumentsstrCon = "Driver={Microsoft ODBC for Oracle}; " & _					 "CONNECTSTRING=(DESCRIPTION=" & _					 "(ADDRESS=(PROTOCOL=TCP)" & _					 "(HOST=host)(PORT=12))" & _					 "(CONNECT_DATA=(SERVICE_NAME=service_name))); uid=uid;pwd=pwd;"	Set oCon = Wscript.CreateObject("ADODB.Connection")Dim oRs: Set oRs = Wscript.CreateObject("ADODB.Recordset")oCon.Open strConSet oRs = oCon.Execute("UPDATE CCN SET USER_NUM1=1011")oCon.CloseSet oRs = NothingSet oCon = Nothing

When i leave the Wscript part then i get a different errorMicrosoft VBScript runtime error: Object required: 'Arguments'.

dim command_line_argsset command_line_args = ArgumentsstrCon = "Driver={Microsoft ODBC for Oracle}; " & _					 "CONNECTSTRING=(DESCRIPTION=" & _					 "(ADDRESS=(PROTOCOL=TCP)" & _					 "(HOST=host)(PORT=12))" & _					 "(CONNECT_DATA=(SERVICE_NAME=service_name))); uid=uid;pwd=pwd;"	Set oCon = CreateObject("ADODB.Connection")Dim oRs: Set oRs = CreateObject("ADODB.Recordset")oCon.Open strConSet oRs = oCon.Execute("UPDATE CCN SET USER_NUM1=1011")oCon.CloseSet oRs = NothingSet oCon = Nothing

Why am i getting these error messages?? is there something i can do about it??Thanks in Advance.Ps. when is start the script from the cmd prompt it works fine, but when i start the script with the program it should be started with the error messages appears.

Link to comment
Share on other sites

Found out that you can't use Arguments for custom action. But that you have to use Properties, but i am not sure how this works. Does anyone know??Btw my parameters(arguments) are variable and different every time, don't know if that is a problem?

Link to comment
Share on other sites

from the cmd prompt it works fine, but when i start the script with the program it should be started with the error messages appears.
What program? Can you post the code you're using to run the script from that program?I think you are complicating matters for yourself by using a script written by someone for Windows Script Host (shown by the wscript.arguments line that is giving you trouble). Windows Script Host is intended for executing script from the Windows command prompt or Windows desktop.If you post details of how you start the script from your program, maybe someone can make a better suggestion about passing your variable information to the script.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...