Question : How to retrieve error number and or message from osql run from command line

How can I retrieve the error number of an osql script run from the command line? What I am actually doing is creating a VB program that automatically runs scripts to update several databases. So, I am actually Shelling the code as if running from a command line. What I am really needing is for the osql command to send me back an error number to VB; however if I have to print the error to a file and read it from VB or something, that would be alright.
Anybody have any thoughts on this?

Answer : How to retrieve error number and or message from osql run from command line

Unfortunately you cannot use the VB Shell function as it does not return a success or failure.  Instead you have a couple of options that I know of:
1. Use the run method in the WshShell Object:
http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx
As in (using late binding):
Set WshShell = CreateObject("WScript.Shell")
Return = WshShell.Run(Cmd, 7, True)
Set WshShell = Nothing

2. Use the ShellExecute API directly.  See here for a full discussion on the subject:
http://vbnet.mvps.org/code/intrinsic/sehyperlink.htm
Random Solutions  
 
programming4us programming4us