急,在线等待,数据库问题
我要在c#应用程序中,程序启动时就把存储过程执行一下,或者其他方法
指点一下下面的错误
string str = @"osql.exe /u sa /p /s localhost/master /i p_killspid.sql";
Console.Write(str);
Console.ReadLine();
Process process = new Process();
process.StartInfo.FileName = @"cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
try
{
process.Start();
}
catch(Exception e1)
{
MessageBox.Show(e1.Message);
}