Click here to Skip to main content
14,301,527 members

Installing MSDE with .NET Application

Rate this:
4.59 (24 votes)
Please Sign up or sign in to vote.
4.59 (24 votes)
28 Nov 2005
This article shows how to distribute or install MSDE with a .NET application.

Image 1


It is common to distribute MSDE 2000 with your .NET application. There are different ways of doing this like, using merge modules or writing one more .NET application to particularly install MSDE 2000. We will be seeing the latter approach here. In my previous articles, I have used custom actions for such installations but here we cannot use custom actions because the .NET setup application does not allow another setup to run from within it. Therefore in such situations you need to create a .NET application which will first install your main .NET application and then MSDE 2000. Make sure the .NET Framework is installed on the target machine because your starting application is made using any one of the .NET languages. You can use AUTORUN file on your CD to install the .NET Framework and then you can run your application which will install both the main application and the MSDE 2000. Before starting the design of the application, many of us would like to know what MSDE is. So let’s start with the basics of MSDE.

Overview of MSDE

The Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) is a data engine built and based on the core SQL Server technology. With support for single and dual processor desktop computers, MSDE 2000 is a reliable storage engine and query processor for desktop extensions of enterprise applications. The common technology base shared between the SQL Server and MSDE 2000 enables developers to build applications that can scale seamlessly from the portable computers to multiprocessor clusters. Designed to run in the background, supporting transactional desktop applications, MSDE 2000 does not have its own user interface (UI) or tools. Users interact with MSDE 2000 through the application in which it is embedded. MSDE 2000 is packaged in a self-extracting archive for ease of distribution and embedding. In addition, MSDE 2000 can be built into applications and redistributed royalty-free with Microsoft development tools, such as Microsoft Visual Studio® .NET and Microsoft Office XP Developer Edition. This allows developers to build enterprise class reliability and advanced database features into their desktop applications. An attractive alternative to using the Microsoft JET database, MSDE 2000 is designed primarily to provide a low-cost option for developers who need a database server that can be easily distributed and installed with a value-added business solution. Because it is fully compatible with other editions of SQL Server, developers can easily target both SQL Server and MSDE 2000 with the same core code base. This provides a seamless upgrade path from MSDE 2000 to SQL Server if an application grows beyond the storage and scalability limits of MSDE 2000.

Download MSDE 2000

Downloadable file name: SQL2kdesksp3.exe SP3a. SP3a updates for MSDE includes updates and new installations for the database components of the instances of the SQL Server 2000 Desktop Engine, including: the Desktop data engine. Database client connectivity components include the OLE DB Provider for SQL Server, the SQL Server ODBC driver, and the client NET-Libraries. SQL2kdesksp3.exe includes all the files that are required to install a new instance of the Desktop engine (.msi files), to upgrade all the existing instances of the Desktop engine (.msp files), as well as to consume merge modules (.msm files) into applications.

MSDE 2000 setup parameters

SAPWD="AStrongPassword"Specifies a strong password to be assigned to the sa administrator login.
INSTANCENAME="InstanceName"Specifies the name of the instance. If INSTANCENAME is not specified, the setup installs a default instance.
DISABLENETWORKPROTOCOLS=nSpecifies whether the instance will accept network connections from the applications running on other computers. By default, or if you specify DISABLENTWORKPROTOCOL=1, the setup configures the instance to not accept network connections. Specify DISABLENETWORKPROTOCOLS=0 to enable network connections.
SECURITYMODE=SQLSpecifies that the instance be installed in Mixed Mode, where the instance supports both Windows authentication and SQL authentication logins.

Specifies the folder where the setup installs the system databases, error logs, and installation scripts. The value specified for the data_folder_path must end with a backslash (\). For a default instance, the setup appends MSSQL\ to the value specified. For a named instance, the setup appends MSSQL$InstanceName\, where InstanceName is the value specified with the INSTANCENAME parameter. Setup builds three folders at the specified location: a Data folder, a Log folder, and a Script folder.


Specifies the folder where the setup installs the MSDE 2000 executable files. The value specified for executable_folder_path must end with a backslash (\). For a default instance, the setup appends MSSQL\Binn to the value specified. For a named instance, the setup appends MSSQL$InstanceName\Binn, where InstanceName is the value specified with the INSTANCENAME parameter.

You can install up to 16 copies, or instances, of MSDE 2000 and the SQL Server 2000 database engine on the same computer. One of the instances has no instance name, and is called the default instance. The other 15 instances must have unique instance names, and are called named instances. When installing a new instance of MSDE 2000 Release A, use the Desktop Engine Setup.exe INSTANCENAME parameter to specify the name of a named instance. If you do not specify an instance name, the setup will attempt to install a default instance.

Overview of the installer application

The logic used is very simple. We are just creating a setup.ini file by passing the setup parameters collected through form and by using this setup.ini to run setup.exe.

Using the demo application

For running the demo application you need to have MSDE 2000. I am not providing it with my application because of the size restrictions (70 MB). Just download the MSDEInstaller application in one folder and place the MSDE 2000 folder in the same directory and start using the application. Sufficient tool tips are provided for your help.

Using the source code

Some important functions are discussed below:

To get the program files of the system

You can see that default path is set for the Target directory and the Data directory. This is possible by using Environment.GetFolderPath:


To create setup.ini

setup.ini file is necessary from the installation point of view. The MSDE 2000 setup takes all the information needed for installation from this file. We will be passing all the information collected from the form to this file. We will be using the IO operations to create this file:


//This part will create setup.ini file in MSDE2000 
//folder in Application Startup path

FileStream fsOutput = 
   new FileStream(Application.StartupPath.Trim()+"\\MSDE2000\\setup.ini",
   FileMode.Create, FileAccess.Write);
StreamWriter srOutput = new StreamWriter (fsOutput);
string s1,s2;
s1="[Options] DISABLENETWORKPROTOCOLS="+intInstallMode+"
    SECURITYMODE=SQL TARGETDIR="+s2+txtTargetDir.Text.Trim()+s2+" 
srOutput.Close ();
fsOutput.Close ();

To start the installation process

After collecting the parameters from setup.ini we will start installing MSDE 2000 by running setup.exe using System.Process:

// This part will actually install the MSDE2000 
// in specified path. The setup will be 
// saved in Application start up path                
ProcessStartInfo psi = new ProcessStartInfo();
string strInstanceName="", strStrongPass="";
psi.Arguments= "INSTANCENAME="+strInstanceName+"
  SAPWD="+strStrongPass+" DISABLENETWORKPROTOCOLS="+intInstallMode+
  DATADIR="+s2+txtDataDir.Text.Trim()+s2 +"/qb";
// Here we start the process 


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author


Comments and Discussions

QuestionAnd for SQL Express 2005? Pin
Hugo G17-Jul-07 21:37
memberHugo G17-Jul-07 21:37 
munns16-Jan-07 1:55
membermunns16-Jan-07 1:55 
Generaldetecting named msde instances Pin
rajeshatsrin22-Aug-06 20:47
memberrajeshatsrin22-Aug-06 20:47 
QuestionHow to Create a Database after i install SQL MSDE Pin
lpbinh15-May-06 23:58
memberlpbinh15-May-06 23:58 
AnswerRe: How to Create a Database after i install SQL MSDE Pin
Mukund Pujari16-May-06 23:01
memberMukund Pujari16-May-06 23:01 
GeneralRe: How to Create a Database after i install SQL MSDE Pin
lpbinh17-May-06 18:24
memberlpbinh17-May-06 18:24 
GeneralRe: How to Create a Database after i install SQL MSDE Pin
lpbinh21-May-06 14:49
memberlpbinh21-May-06 14:49 
GeneralCannot execute as Custom Action in installer Pin
comet_little5-Apr-06 6:31
membercomet_little5-Apr-06 6:31 
GeneralGreat article and sample code! Pin
comet_little4-Apr-06 17:58
membercomet_little4-Apr-06 17:58 
GeneralWithout .net Pin
brianma6-Dec-05 0:19
professionalbrianma6-Dec-05 0:19 
Generalattach Pin
Taha Amin30-Nov-05 4:38
memberTaha Amin30-Nov-05 4:38 
GeneralRe: attach Pin
Mukund Pujari30-Nov-05 17:56
memberMukund Pujari30-Nov-05 17:56 
GeneralSome pointers for your code Pin
Toughfella29-Nov-05 2:50
memberToughfella29-Nov-05 2:50 
GeneralRe: Some pointers for your code Pin
Mukund Pujari29-Nov-05 16:00
memberMukund Pujari29-Nov-05 16:00 
QuestionMSDE 2000 Deployment Toolkit 1.0 Pin
pauloafc28-Nov-05 22:11
memberpauloafc28-Nov-05 22:11 
GeneralA few comments Pin
DotDue28-Nov-05 21:00
memberDotDue28-Nov-05 21:00 
GeneralRe: A few comments Pin
Mukund Pujari28-Nov-05 21:11
memberMukund Pujari28-Nov-05 21:11 
GeneralRe: A few comments Pin
Vertyg029-Nov-05 8:40
memberVertyg029-Nov-05 8:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 28 Nov 2005


103 bookmarked