Micro Focus QTP (UFT) Forums

Full Version: Converting from WinRunner - command line executable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We are implementing/converting from QTP from WinRunner and below is how we ran cleanup scripts (oracle) in WR:

invoke_application("ExportCleanup.cmd","user password database","K:\\Database_Cleanup_Scripts\\",SW_HIDE);

I was looking for an equivalent in QTP - so we don't have to redo totally everything... I have this that works so far, but it 1) doesn't use what we already have, 2) doesn't scale well for some cleanup scripts that are 20-30 lines long...

Code:
Sub DBCleanup(KScriptName, DSN, uName, uPwd)
    Set objConn=CreateObject("ADODB.connection")
    objConn.Open "Data Source=" & DSN & ";User ID=" & uName & ";Password=" & uPwd & ";LSProvider=ODP;"
    objConn.Execute KScriptName
    objConn.Execute "commit"
    Set objConn = Nothing
End Sub


I tried the wscript.shell object and didn't get any errors, but the data was not removed from the database properly:

Code:
Sub Test
    Set objShell=CreateObject("wscript.shell")
    'command to Execute
    strCommand="K:/Database_Cleanup_Scripts/ExportCleanupXI.cmd user pwd server"
             Set objExec=objShell.Exec(strCommand)
End Sub

Any ideas?