各们高手:怎么在.net里用osql执行.sql脚本,急急~~~~~~~~ 我引用李洪根的.NET平台下WEB应用程序的部署(安装数据库和自动配置)里的osql执行方法,但是不能执行.sql里的语句,郁闷中........ 求用osql执行.sql的代码或实例,和一些注意事项,麻烦各位了.!!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void CreateDataBase (){Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = false; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; string Path = Application.StartupPath.ToString();string Parameter = "osql.exe -U " + uid + " -P " + pwd + " -S "+ ServerName +" -i " + Path + @"\IPMS.sql";try { this.Cursor = System.Windows.Forms.Cursors.WaitCursor;p.Start(); p.StandardInput.WriteLine(Parameter); p.StandardInput.WriteLine("exit"); p.StandardInput.WriteLine("exit");p.WaitForExit(); p.Close();} catch(Exception e) { MessageBox.Show(e.Message);this.Close();} } 缩略图问题? vs2005:如何为Menustrip动态制定图标 请问这个为什么 没用 ********下午去百度笔试,考题有二叉搜索树和堆,全不会。大家说这两个东西有用吗,哪里能用上。星星请回答? 如何在后台搜索一个动态页面上得内容? 200分求完整的C#对ACCESS数据库的增删改查操作代码!不够的另贴帖加分,在线等,急急急!!!! 关于.db文件 【求助】在淘宝页面的分类选择的解决方法 水晶报表10的问题 上传方法 急 C#随机数棘手问题 有个难题,帮忙解决一下!谢谢!
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string Path = Application.StartupPath.ToString();
string Parameter = "osql.exe -U " + uid + " -P " + pwd + " -S "+ ServerName +" -i " + Path + @"\IPMS.sql";
try
{
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
p.Start();
p.StandardInput.WriteLine(Parameter);
p.StandardInput.WriteLine("exit");
p.StandardInput.WriteLine("exit");
p.WaitForExit();
p.Close();
}
catch(Exception e)
{
MessageBox.Show(e.Message);
this.Close();
}
}