Saturday, February 13, 2010

Installing Sql-server 2005 express edition using

In the previous post i had discussed how to install sql-server 2005 express using command prompt. Today I am going to discuss how to install it using code. The code for it is as follows:

using System.Diagnostics;

void InstallExpress()
Process p = new Process();
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = Application.StartupPath.Trim() + @"\SqlServer2005 Express\SQLEXPR.EXE";
            psi.Arguments = "/qn username=\"CustomerUsername\" companyname=\"OurCompany\" addlocal=ALL  disablenetworkprotocols=\"0\" instancename=\"MyInstance\" SECURITYMODE=\"SQL\" SAPWD=\"mypassword\"";

            p.StartInfo = psi;

This is quite simple and easy to implement. Here we have created a process that would run the commands to install the sql-server 2005 express in silent mode.


  1. Thanks dude for the update... it really helped me... i got stuck in it... u saved me... thanks a ton !!!

  2. the problem of data corruption in the files of specified format can be fixed by the file magic sql server will not start utility

  3. Would you tell me how to install sql server database in other system using c# installation project is ready but i don't know how to install database in other system with my c# project.


Comments to this post


Related Posts with Thumbnails