04-24-2008, 12:52 AM
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...
I tried the wscript.shell object and didn't get any errors, but the data was not removed from the database properly:
Any ideas?
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?