Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Passing parameters to a VBScript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47767
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Passing parameters to a VBScript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Passing parameters to a VBScript - 5/30/2007 10:47:47 PM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
Hi,

I'm new to this, but I have VBScript that has embedded SQl to Insert data in a dB, that's cool. but I what to do this dynamically, Does anyone know if/how to a pass the insert data to the script on the command line?

Thanks
 
 
Post #: 1
 
 RE: Passing parameters to a VBScript - 5/30/2007 10:54:43 PM   
  ginolard


Posts: 1053
Score: 21
Joined: 8/10/2005
Status: offline
Search for Wscript.Arguments on here.  There's plenty of examples

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to cmc)
 
 
Post #: 2
 
 RE: Passing parameters to a VBScript - 5/31/2007 1:16:07 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
Great thanks, got it, well almost, I'm passing in 6 variables, any ideas how I can assign each one a name e.g. slot1, slot2 etc

For Each strArg in objArgs
           set strArg = ????????
Next

(in reply to ginolard)
 
 
Post #: 3
 
 RE: Passing parameters to a VBScript - 5/31/2007 1:28:25 AM   
  ebgreen


Posts: 5036
Score: 31
Joined: 7/12/2005
Status: online
Are you relying on the args being passed in a specific order or are you going to use named parameters?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to cmc)
 
 
Post #: 4
 
 RE: Passing parameters to a VBScript - 5/31/2007 1:31:36 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
In a specfic order as I pipe the results to a dB i.e.

objRecordSet.Open "INSERT INTO XXXX VALUES ('" & slot1 & "','" & slot2 & "','" & slot3 & "','" & slot4 & "','" & slot5 & "','" & slot6 & "')" , _
  objConnection, adOpenStatic, adLockOptimistic

Thanks

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Passing parameters to a VBScript - 5/31/2007 1:50:13 AM   
  ebgreen


Posts: 5036
Score: 31
Joined: 7/12/2005
Status: online
 
Set oArgs = WScript.Arguments.Unnamed
objRecordSet.Open "INSERT INTO XXXX VALUES ('" & oArgs.Items(0) & "','" & oArgs.Items(1)& "','" & oArgs.Items(2)& "','" & oArgs.Items(3)& "','" & oArgs.Items(4)& "','" & oArgs.Items(5)& "')"

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to cmc)
 
 
Post #: 6
 
 RE: Passing parameters to a VBScript - 5/31/2007 2:05:09 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
Thanks

Do i need to ref some lib's

error- Microsoft VBScript runtime error: Object doesn't support this property or method: 'oArgs.Items'

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Passing parameters to a VBScript - 5/31/2007 2:06:41 AM   
  ebgreen


Posts: 5036
Score: 31
Joined: 7/12/2005
Status: online
Ooops....typo. Make Items be Item.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to cmc)
 
 
Post #: 8
 
 RE: Passing parameters to a VBScript - 5/31/2007 2:12:33 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
very cool!

(in reply to ebgreen)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Passing parameters to a VBScript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts