Solved

How to: Install SQL Server 2005 Express with INNO setup

Posted on 2008-11-02
4
9,406 Views
Last Modified: 2012-05-05
Hi,

How can I install SQL Server 2005 Express with INNO setup. Does anybody done this and can explain it to me? The things that I would like to accomplish are:

Check if (an older version of) SQL Server is already installed (or when the user wants to install another instance of it)
- install SQL Server 2005 Express unattended with parameters
Installation will only be done on Windows XP, Vista and Windows Server 2003.

I would appreciate a description as detailed as possible, so I know how to set thing up correctly. Maybe somebody is willing to share a INNO Setup projectfile where this is done.
0
Comment
Question by:Delphiwizard
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
tigin44 earned 500 total points
ID: 22861187
hi DelphiWizard
an Inno script like below can help you

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Languages]
Name:English;MessagesFile:"compiler:Default.isl"

[Setup]
AppName=EgtMrk2007
AppVerName=Eitim Merkezleri Veri Giri_ Uygulamas1 V.1.0
AppPublisher=K.K.Personel Ba_kanl11 YBS ^. Md.lüü
AppPublisherURL=https://perybs.kkk.tsk
AppSupportURL=https://perybs.kkk.tsk
AppUpdatesURL=https://perybs.kkk.tsk
DefaultDirName=c:\EgtMrk2007
DefaultGroupName=EgtMrk2007
AllowNoIcons=yes
Compression=lzma
SolidCompression=yes

[Code]

const
  SQLDMOGrowth_MB = 0;
var
  SqlKurma:Boolean;

procedure SQLDMOButtonOnClick(SDir,DDir:String);
var
  SQLServer, Database, DBFile, LogFile: Variant;
  SQLServerName:string;
  i,j:integer;
  egtmrkC:boolean;
begin
  if SQLKurma=True then exit;

  egtmrkC:=False;
      {Named instance SQLSERVER}
  SQLServerName:=GetComputerNameString+'\SQLSERVER';
   { Create the main SQLDMO COM Automation object }
   try
    SQLServer := CreateOleObject('SQLDMO.SQLServer');
  except
    RaiseException('Please install Microsoft SQL server connectivity tools first.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
  end;
   { Connect to the Microsoft SQL Server }
  SQLServer.LoginSecure := True;
  try
    SQLServer.Connect(SQLServerName);
  except
    RaiseException('SQL Server is not installled or the service is not started.'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
    exit;
  end;
 
  { Setup AnyDataBase }
  Database := CreateOleObject('SQLDMO.Database');
  Database.Name := 'AnyDataBase';

  DBFile := CreateOleObject('SQLDMO.DBFile');
  DBFile.Name := 'AnyDataBase_Data';
  DBFile.PhysicalName :=DDir+'\AnyDataBase.mdf';
  DBFile.PrimaryFile := True;
  DBFile.FileGrowthType := SQLDMOGrowth_MB;
  DBFile.FileGrowth := 1;

  Database.FileGroups.Item('PRIMARY').DBFiles.Add(DBFile);

  LogFile := CreateOleObject('SQLDMO.LogFile');
  LogFile.Name := 'AnyDataBase_Log';
  LogFile.PhysicalName :=DDir+'\AnyDataBase.ldf';

  Database.TransactionLog.LogFiles.Add(LogFile);
end;

Function SQLKur:Boolean;
begin
  if ((msgBox ('Do you want to install SQL Server?',mbinformation,mb_YesNo)=idYes)) then
   Result:=True
 else
  begin
    Result:=False;
    SQLKurma:=True;
  end;
end;

Function SQLKontrol:Boolean;
Var
 PortNum:string;
begin
 if ((RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Microsoft SQL Server\AnyDataBase\SETUP','SQLPath')) or (SQLKur=False)) then //Exists or do not install
   Result:=False
 else Result:=True;
end;

[Tasks]

[Files]
Source: "c:\SQL Server 2005 Express\*" ; DestDir: "{app}\SQL Server 2005 Express"; Flags: onlyifdoesntexist

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Run]
Filename: "{app}\SQL Server 2005 Express\setup.exe" ; Parameters: "SECURITYMODE=SQL  DISABLENETWORKPROTOCOLS=0 SAPWD=""AnyPassword"" instancename=""SQLSERVER"""; WorkingDir: {app}\SQL Server 2005 Express; StatusMsg: SQL Server Setup;Check:SQLKontrol

[Icons]

[Run]
0
 

Author Comment

by:Delphiwizard
ID: 22862117
Thank you for the script.
Can this script be integrated into the script that I use to install my own application?
0
 
LVL 26

Expert Comment

by:tigin44
ID: 22863568
sure you can integrate tat scipt with yours... Actually I pulled it out from one of my application set up scripts.
0
 

Author Closing Comment

by:Delphiwizard
ID: 31512462
Thank you very much!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

11 Experts available now in Live!

Get 1:1 Help Now