Assembly asm=Assembly.GetExecutingAssembly();
string setuppath=asm.Location;
/*string store_proc="Exec sp_attach_db @db=N'RnClient,@filename1=N'"+setuppath+"\\Clientdat.mdf,@filename2=N'"+setuppath+"\\RnClinet_log.ldf";*/
Process sqlProcess= new Process();
sqlProcess.StartInfo.FileName="osql.exe";
/*sqlProcess.StartInfo.Arguments = string.Format(" -U {0} -P {1} -d {2} -i {3}store_proc", this.Context.Parameters["user"], this.Context.Parameters["pwd"], this.Context.Parameters["dbname"], this.Context.Parameters["targetdir"]);*/
sqlProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
sqlProcess.Start();
sqlProcess.WaitForExit(); 
sqlProcess.Close();如何让/*....*/中语句正确执行!正确的该如何写!

解决方案 »

  1.   

    你最后那句 store_proc 是什么意思?
      

  2.   

    /*string store_proc="Exec sp_attach_db N'RnClient',N'"+setuppath+"\\Clientdat.mdf,N'"+setuppath+"\\RnClinet_log.ldf";*/
    /*sqlProcess.StartInfo.Arguments = string.Format(" -U {0} -P {1} -d {2} /Q {3}", this.Context.Parameters["user"], this.Context.Parameters["pwd"], this.Context.Parameters["dbname"], store_proc);*/
      

  3.   

    为什么没有人回答我如保在部署 时使用SP_attach_db?还有我的安装类里没有public override void Install(System.Collections.IDictionary stateSaver)类,只有public override void Commit(IDictionary savedState)
    {
    base.Commit (savedState);
    }类