How to attach Database on msde 2000 using installshield

Posted on 2004-11-11
Last Modified: 2013-11-14
I am new to installshield.  I have developed a application using VS.Net 2003. The VS.Net solution contains
1) Windows Form Project
2) Web Project
3) Class Library Project.

I am using sql server 2000 database as backend.

I have made deployment package using Installshiled X and from that i am installing MSDE 2000 on Client Machine. Upto this every goes ok.  After installation of msde 2000, i have to carry out some steps. But the MSDE service is not started.

1) While Installing MSDE i want to give name to the instance and sapassword aslo.
2) How to start MSDE 2000 service after it gets installed from installshield.
3) Attach my Database to MSDE 2000 while installation.

I want to do all this using Installshiled X

Thanks for your help in  advance,

Question by:skullden
    LVL 10

    Expert Comment

    Command Line to Execute Unattended Install
    The following syntax is used to install MSDE using all of the default installation settings. You must always indicate the fully qualified path to the .iss file on the command line. The following text was used to install MSDE on my laptop:

          E:\MSDE\MSDEx86.exe -s -a -f1 "E:\MSDE\unattend.iss"

    As stated before, there are numerous command line switches that may be applied to the installation, but only these three were used. Notice the explanation for these as provided by MSDN:

    -s Silent Mode (required for unattended installations, suppresses any installation-related windows or dialogs)
    -a Append (passes any subsequent parameters to installation executable after it is unpackaged)
    -fl Setup Initialization File (used to pass the path and file name of a setup initialization file)
    check the full article at with many useful links


    Author Comment

    TOPIO Thanks for the reply, But as i mentioned i want to do all these steps using Installshield. And i am not sure that what is the frive letter of the cd rom ie. E:, F: etc.

    LVL 10

    Expert Comment

    ok then from
    Using MSDE 2000 with InstallScript Projects
    This is an example of how to use the MSDE 2000 setup.exe in an InstallScript project in InstallShield DevStudio 9 for both installation and uninstallation.

    Note: Your mileage may vary depending on which version of IS you use. These instructions should work with 7.0 and higher.

    1) Add a new component to any feature. Call it "MSDE2000".

    2) Set the destination on that component to <SUPPORTDIR>.

    3) Make sure the following options on that component are set accordingly:

    Shared = No
    Uninstall = Yes
    Self-Register = No
    Potentially Locked = No
    Compressed = Yes

    4) Click the elipsis (...) on the Link Type option in the new component.
    Select 'Dynamic Links'. Specify the path to your extracted MSDE2000 install files. Make sure you check the 'Include subfolders' box.

    5) Insert the following code into OnFirstUIAfter() after ShowObjWizardPages(NEXT); :

    setuppath = SUPPORTDIR ^ "setup.exe";
    msdecmd = "<setup.exe options go in here>";
    LaunchAppAndWait(setuppath, msdecmd, LAAW_OPTION_WAIT);
    if (LAAW_PARAMETERS.nLaunchResult != 0) then
        MessageBoxEx( "MSDE 2000 failed to install.", "Install", SEVERE );
    Note: Make sure to define two new string variables in OnFirstUIAfter(): setuppath and msdecmd Also, refer to the MSDE ReadMes and Docs for the correct setup.exe options.

    6) Insert the following code into OnMaintUIAfter() after ShowObjWizardPages(NEXT); :

    if (UninstallMSDE == TRUE) then
        szMsg2 = IsMSDEInstalled();
        if (szMsg2 != "") then
            SetStatusWindow(100,"Uninstalling MSDE 2000...");
            szTitle = WINSYSDIR ^ "msiexec.exe";
            szMsg1 = "/x " + szMsg2 + " /qb! REBOOTPROMPT=S";
            LaunchAppAndWait(szTitle, szMsg1, LAAW_OPTION_WAIT);
    Note: What i've done here is created a function (IsMSDEInstalled()) that queries the registry to find the Product Code for the particular MSDE installation that was installed. You'll need this product code in order to perform an uninstallation (if that is your desire) when the whole package is uninstalled.

    As well, i've set the boolean variable UninstallMSDE to TRUE only if the user selects to remove all components (i.e. a full uninstall) in the package. You can do this in the OnMaintUIBefore() function.

    7) Use the following exsample to develop your own IsMSDEInstalled():

    function STRING IsMSDEInstalled()
        STRING sKey;
        NUMBER nTemp, nLength;
        if (RegDBGetKeyValueEx("SOFTWARE\\Microsoft\\Microsoft SQL Server\\INSTANCE\\Setup",
                               "ProductCode",nTemp,sKey,nLength) == 0) then
            return sKey;
            return "";
    Note: You must replace INSTANCE with the particular instance name that you used in the call to setup.exe. If you didn't use an instance, consult the Microsoft KB or the MSDN Library to find out which registry key to query for the Product Code.

    That's it. This should both install and uninstall MSDE 2000 wherever you'd like.

    then you go to the section called
    SQL Server Database Maintenance
    Here are three script functions to check whether a database exists, to create a database and to execute SQL scripts. The new version was tested with InstallShield Developer 8. The old script (also included) was created with IS6 and tested with SQL Server 7 and 2000 on Windows 2000 Server and Professional.

    Updated: ExecuteSQLScript function works similar to isql and osql utilities, enabling the execution of multiple statements closed by GO, handles comments, and provides log if errors occured.   Written by Craig E. Hohlbein, György Földvári


    Author Comment

    Thanks for the help...
    Now i am able to install MSDE2000 by using installshiled meege modules.. the installation cof msde completes.. still no problem.. but the MSDE 2000 SQL Server Agent dose not start i have to start is manually.. else i have to reboot the machine.. to avoid restart and to start the sql server service after installation wht shall i do.. i have set all the paramaerts in a ini file.
    LVL 10

    Expert Comment

    the restart is going to be an issue what are your target os(es)

    Author Comment

    Mostly it will be Windows XP Professional, windows server 2000 or windows server 2003. Really i am stuck up will this issue, the msde 2000 is getting installed properly.. but i have to stop the installation manually and then start the service manually and restart the setup again.. every time it is not possible that there will be technical person for installation.. i will be distrubuting the cd.. so how to start the nsde service after installation of MSDE 2000. plz help.


    Author Comment

    I got one script from microsoftsite to start msde 2000, after the installation of msde 2000 is finished using installshield X. Here is the script

    Public Function sStartMSDE()  As String
    'This subroutine will turn on MSDE. If the server has been started
    'the error trap will exit the function leaving the server running
    'Note that it will not place the SQL Service Manager on the start bar.
    '   sSvrName    The server to be started
    '   sUID        The user used to start server
    '   sPWD        The password of user
    '   Resolution of start
    '   SQLDMO

        Dim osvr As SQLDMO.SQLServer

        Set osvr = CreateObject("SQLDMO.SQLServer")
        'Create the SQLDMO Server Object
        On Error GoTo StartError 'Error Trap
        osvr.LoginTimeout = 60
        'Start Server
        osvr.start True, "(local)", "sa", "mypwd"
        'Return results
        sStartMSDE = "SQL Server Started "

        Exit Function

        If Err.Number = -2147023840 Then
        'This error is thrown when the server is already running,
        'and Server.Start is executed on NT
            osvr.Connect "(local)", "sa", "mypwd" 'Connect to Server
            'Return results
            sStartMSDE = " SQL Server Already Started"
        Else 'Unknown Error
            'Return results
            sStartMSDE = Err.Description
        End If
        Resume ExitSub
    End Function

    but i am not able to execute this script. i am trying to execute this script using the option of installshield x "Custom Actions"
    wht i am missing i am not able to find.. again the same problem msde 2000 get installed but the service is not started.

    Author Comment

    Thanks TOPIO  for your help..
    My problem is sloved. I created a custom action and started the sql server service.

    Accepted Solution

    PAQed with points refunded (125)

    Community Support Moderator

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    A short article about problems I had with the new location API and permissions in Marshmallow
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now