Im trying to run a T-Sql script using Sqlcmd.exe through a C# button click event. I can run the script through the command prompt but it's not running through C#
Note: Through C# a command window pops up for a short time like it runs but the output text file is not created.
Through the command line, the output text file is created with the data requested by the script.
Note: Through C# a command window pops up for a short time like it runs but the output text file is not created.
Through the command line, the output text file is created with the data requested by the script.
Code:
using System.Diagnostics;
Code:
private void button1_Click(object sender, EventArgs e)
{
Process RunSQLScript = new Process();
RunSQLScript.StartInfo.FileName = "sqlcmd.exe";
RunSQLScript.StartInfo.Arguments = "- E -S clovis-003 -i c:\test.sql -o c:\testData.txt";
RunSQLScript.Start();
}