|
|
|
date: Wed, 20 Aug 2008 00:42:28 -0700 (PDT),
group: microsoft.public.scripting.vbscript
back
Re: What does the .run method return
On Aug 20, 6:23 am, deepal...@gmail.com wrote:
> Out parameters are returned back and the In parameters are used as
> input.
> Fro example i can do
> Set objParameter = objCommand.CreateParameter ("ConfirmID", 3, 2)
> 2- specifies that its an Out param
>
> You can refer tohttp://www.devguru.com/Technologies/ado/quickref/command_createparame...
> for more details
> But i just wanted to confirm if a record type can be declared or not
The short answer is NO. I say that because your sample executes a VBS
script, not a database stored procedure. VBS scripts can output text
to a console window or GUI message box. But, they do not create
output parameters.
However, I am confused by your question. In one place you reference
'stored procedure', yet your example is a VBS script. Does your
script connect to a database in which there is a stored procedure?
Personally, I would need to see a snippet of code from that script and
have a better explanation of what exactly you're trying to accomplish
before I could comment further.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
date: Wed, 20 Aug 2008 05:16:55 -0700 (PDT)
author: Tom Lavedas
Re: What does the .run method return
> The short answer is NO. I say that because your sample executes a VBS
> script, not a database stored procedure. VBS scripts can output text
> to a console window or GUI message box. But, they do not create
> output parameters.
>
> However, I am confused by your question. In one place you reference
> 'stored procedure', yet your example is a VBS script. Does your
> script connect to a database in which there is a stored procedure?
>
> Personally, I would need to see a snippet of code from that script and
> have a better explanation of what exactly you're trying to accomplish
> before I could comment further.
>
> Tom Lavedas
> ===========http://members.cox.net/tglbatch/wsh/
I have a batch job that calls a VBscript. This Vbscript connects to
the database and calls the stored procedure. The stored procedure
takes one input parameter and returns only one row with 2 column. both
the columns are integer.
Please find the code below
Batch job. Call to the VBscript
Dim ret
set ws = Wscript.CreateObject("Wscript.Shell")
ret = ws.run("\\C\Delete_Data.vbs SQL024301 Taurus_ NT NT Config_New 3
0",7,true)
wscript.quit ret
VBscript.. pasting only the main function not all of them
'Main procedure
Sub delete_data
WriteLog "Calling stored procedure
Product_DeleteReqItemResErr ..."
On Error Resume Next
Dim objCmd
set objCmd = CreateObject("ADODB.Command")
' set rs = CreateObject("ADODB.RecordSet")
With objCmd
.ActiveConnection = Scn
.commandtimeout = 9000
.CommandText = "test_Product_DeleteReqItemResErr"
.CommandType = 4
.Parameters.Append .CreateParameter("date_diff_days", 3, 1)
End With
rs = objCmd.Execute
' If Not rs.EOF Then
' outTotalConfigId = rs.Fields(0)
' outTotalBundleId = rs.Fields(1)
' End If
Scn.CommandTimeout = 600
On Error Resume Next
If Err.Number <> 0 Then
WriteLog Err.Description & " (" & Err.Number & ")"
FatalError
End If
On Error Goto 0
WriteLog "Product Config Deletion Success!"
Writelog " Product Config Deletion Exit code is 0 "
Closedown
Wscript.quit 0
End sub
Thanks
Deepal
date: Wed, 20 Aug 2008 05:42:54 -0700 (PDT)
author: unknown
Re: What does the .run method return
wrote in message
news:7e3371cc-d4ef-4e2e-9642-282089cccdf0@f36g2000hsa.googlegroups.com...
> The short answer is NO. I say that because your sample executes a VBS
> script, not a database stored procedure. VBS scripts can output text
> to a console window or GUI message box. But, they do not create
> output parameters.
>
> However, I am confused by your question. In one place you reference
> 'stored procedure', yet your example is a VBS script. Does your
> script connect to a database in which there is a stored procedure?
>
> Personally, I would need to see a snippet of code from that script and
> have a better explanation of what exactly you're trying to accomplish
> before I could comment further.
>
> Tom Lavedas
> ===========http://members.cox.net/tglbatch/wsh/
I have a batch job that calls a VBscript. This Vbscript connects to
the database and calls the stored procedure. The stored procedure
takes one input parameter and returns only one row with 2 column. both
the columns are integer.
Please find the code below
Batch job. Call to the VBscript
Dim ret
set ws = Wscript.CreateObject("Wscript.Shell")
ret = ws.run("\\C\Delete_Data.vbs SQL024301 Taurus_ NT NT Config_New 3
0",7,true)
wscript.quit ret
VBscript.. pasting only the main function not all of them
'Main procedure
Sub delete_data
WriteLog "Calling stored procedure
Product_DeleteReqItemResErr ..."
On Error Resume Next
Dim objCmd
set objCmd = CreateObject("ADODB.Command")
' set rs = CreateObject("ADODB.RecordSet")
With objCmd
.ActiveConnection = Scn
.commandtimeout = 9000
.CommandText = "test_Product_DeleteReqItemResErr"
.CommandType = 4
.Parameters.Append .CreateParameter("date_diff_days", 3, 1)
End With
rs = objCmd.Execute
' If Not rs.EOF Then
' outTotalConfigId = rs.Fields(0)
' outTotalBundleId = rs.Fields(1)
' End If
Scn.CommandTimeout = 600
On Error Resume Next
If Err.Number <> 0 Then
WriteLog Err.Description & " (" & Err.Number & ")"
FatalError
End If
On Error Goto 0
WriteLog "Product Config Deletion Success!"
Writelog " Product Config Deletion Exit code is 0 "
Closedown
Wscript.quit 0
End sub
Thanks
Deepal
--------
Shouldn't it be:
Set rs = objCmd.Execute
I am able to set the CommandType property of ADO Command objects in
VBScript.
The code to retrieve the two field values for the recordset is commented
out, but I don't see how this can be returned using the Run method of the
wshShell object. You could return one integer by specifing a value in the
Quit method:
Wscript.Quit 5
I believe the Run method would then return 5.
In the VBS above you could write the values to a text file. Can you just
skip the first VBS program (the one that runs this program) and do what you
want in this second VBS program? Otherwise I think the solution is to write
the values to a temporary file that the first VBScript program can read. Or,
you might try using the Exec method of the wshShell object in the first
program and reading StdOut. The second VBS would be revised to echo the
values with Wscript.Echo commands.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
date: Wed, 20 Aug 2008 13:52:30 -0500
author: Richard Mueller [MVP]
|
|