Solved

How to: Install SQL Server 2005 Express with INNO setup

Posted on 2008-11-02
4
9,476 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the frequent problems with the installations is when some file or registry entry is not removed from the system upon un-installation of the product. Clean removal is always highly desirable. One major reason for that is badly authored inst…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

19 Experts available now in Live!

Get 1:1 Help Now