开发者

VB script to run a Query

I am trying to connect command prompt through VB script and further its connecting with Oracle enviroment to execute some reports of Oracle discoverer. But the problem is with this VB script only.

line 2: for establishing the connection. line 7:fetching the current REQUEST_ID. line 16:XXDIS_EXPORT_CMD_V is a view and cmd is a column.which select a value like this for corresponding REQUEST_ID. /CONNECT DISCADMIN:"FAI Financials Intelligence"/discbi@deverp /OPENDB "1 Scheduling" /SHEET "Sheet_1" /EXPORT HTML o27673334.out /LOGFILE l27673334.log /BATCH

In the end i want to execute this cmd using VBScript.

Error coming :

"In line 32 tkgoShell was not recognized"

This is My code:

' Process job
    Set objADO =CreateObject("ADODB.Connection")
    objADO.Open "Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=deverp; UID=apps; PWD=apps11i;"
    MsgBox "Connection Established to Server.", vbExclamation + vbOKOnly, "System"
    Do While True
    ' Check if there 开发者_运维问答is a job to process
    Set moRS=objADO.execute("SELECT apps.xxdis_schedule_pkg.start_job REQUEST_ID FROM dual")
    moRS.MoveFirst
    msRequest = moRS("REQUEST_ID")
    'MsgBox msRequest,msRequest
    ' If no jobs then exit
    ' If msRequest = "0" Then
    Exit Do
    ' End If
    loop
    Set moRS=objADO.execute("SELECT cmd EXPORT_CMD FROM apps.xxdis_export_cmd_v " & _
    "WHERE request_id = " & msRequest)
    MsgBox msRequest,msRequest
    moRS.MoveFirst
    msExpCmd = moRS("EXPORT_CMD")
    ' write command into a temporary file
    msCmdFile = "r" & msRequest & ".cmd"
    dim moOutputStream,filesys,msCommand
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set moOutputStream = filesys.CreateTextFile(msCmdFile, True)
    ' Substitute $SAMBA$ and $TNS$ locally configured variables
    moOutputStream.Write Replace(Replace(msCmd, "$SAMBA$", gsOutDir),_
    "$TNS$", gsInstance) & vbCRLF
    moOutputStream.Close
    ' Call Discoverer to process the command
    msCommand = gsBinDir & gsDiscoExe & " /EUL " & gsEUL & " /CMDFILE " & msCmdFile
    Call tkgoShell.Run (msCommand, 1, true)


If I understand your code correctly I can't see anywhere where you're actually creating the tkgoShell.

Try inserting the following 2 rows before your last line:

Dim tkgoShell
Set tkgoShell = WScript.CreateObject ("WScript.Shell")

See here for more information about Shell.Run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜