急,在线等待,数据库问题

cxyPioneer 2004-07-15 08:29:02
我要在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);
}
...全文
85 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxyPioneer 2004-07-15
  • 打赏
  • 举报
回复
是通过SQL语句,程序一启动在master数据库中建立这个存储过程,不是去执行这个存储过程
happyyht 2004-07-15
  • 打赏
  • 举报
回复
string str="Exec dbo.SP_Users";
就是这么简单!代码太多了.看的都烦!

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧