Hi All,
i m trying to execute the sql script through vb.net
I m using the following code to get the output of execution of the osql as follows
I get the output as string
if i execute the same command through cmd it runs successfully and i get nothing as output
But when i run it through vb.net it shows the prompt and the command that i have given, in output string
if there is no error i expect output string to be blank, so that i can trace up that there is no error
Pls help
Regards
Sanjay
i m trying to execute the sql script through vb.net
I m using the following code to get the output of execution of the osql as follows
VB.NET:
sCommand = "osql -b -n -S " & sServernme & " -U " & sUser & " -P " & sPwd & " -d " & sDBName & " -i " & sPath & filename
'Note : The file is a .sql file
Dim si As ProcessStartInfo = New ProcessStartInfo("cmd.exe")
' Redirect both streams so we can write/read them.
si.RedirectStandardInput = True
si.RedirectStandardOutput = True
si.RedirectStandardError = True
si.UseShellExecute = False
' Start the procses.
Dim p As Process = Process.Start(si)
' Issue the dir command.
p.StandardInput.WriteLine(sCommand)
' Exit the application.
p.StandardInput.WriteLine("exit")
' Read all the output generated from it.
Dim output As String = p.StandardOutput.ReadToEnd
I get the output as string
if i execute the same command through cmd it runs successfully and i get nothing as output
But when i run it through vb.net it shows the prompt and the command that i have given, in output string
if there is no error i expect output string to be blank, so that i can trace up that there is no error
Pls help
Regards
Sanjay