vb.net Shell() successful?
-
I execute the following command, but want to see if it successfully created the xml file: cmd = "bcp ""select * from dbName..tableName where StudyNo = " & SN & """ queryout c:\tResultQue.xml -c -S servername -U uname -P pwd" Shell(cmd) I tried the following, but it won't work as it executes before the file is created: If File.Exists("c:\tResultQue.xml") Then 'success Else 'failed End If Thank you for any help!
-
I execute the following command, but want to see if it successfully created the xml file: cmd = "bcp ""select * from dbName..tableName where StudyNo = " & SN & """ queryout c:\tResultQue.xml -c -S servername -U uname -P pwd" Shell(cmd) I tried the following, but it won't work as it executes before the file is created: If File.Exists("c:\tResultQue.xml") Then 'success Else 'failed End If Thank you for any help!
Rather than using Shell, you should create a Process object to run the command. The Process class allows you to wait for a return code that signals the execution has terminated.
-
Rather than using Shell, you should create a Process object to run the command. The Process class allows you to wait for a return code that signals the execution has terminated.