Thanks Vahan, I'll have a look.

--- In [email protected], Vahan Yoghoudjian <[EMAIL PROTECTED]> 
wrote:
>     I have copied this from one of InnoSetup samples Jason 
mentioned, it
> might be helpful for you, at least a point to start with...
> 
>     Regards
>     Vahan
> 
> 
> const
>   SQLServerName = 'localhost';
> 
> procedure SQLDMOButtonOnClick(Sender: TObject);
> var
>   SQLServer, Database, DBFile, LogFile: Variant;
>   IDColumn, NameColumn, Table: Variant;
> begin
>   if MsgBox('Setup will now connect to Microsoft SQL Server ''' +
> SQLServerName + ''' via a trusted connection and create a 
database. Do you
> want to continue?', mbInformation, mb_YesNo) = idNo then
>     Exit;
> 
>   { 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;
>   SQLServer.Connect(SQLServerName);
> 
>   MsgBox('Connected to Microsoft SQL Server ''' + SQLServerName 
+ '''.',
> mbInformation, mb_Ok);
> 
>   { Setup a database }
> 
>   Database := CreateOleObject('SQLDMO.Database');
>   Database.Name := 'Inno Setup';
> 
>   DBFile := CreateOleObject('SQLDMO.DBFile');
>   DBFile.Name := 'ISData1';
>   DBFile.PhysicalName := 'c:\program files\microsoft sql
> server\mssql\data\IS.mdf';
>   DBFile.PrimaryFile := True;
>   DBFile.FileGrowthType := SQLDMOGrowth_MB;
>   DBFile.FileGrowth := 1;
> 
>   Database.FileGroups.Item('PRIMARY').DBFiles.Add(DBFile);
> 
>   LogFile := CreateOleObject('SQLDMO.LogFile');
>   LogFile.Name := 'ISLog1';
>   LogFile.PhysicalName := 'c:\program files\microsoft sql
> server\mssql\data\IS.ldf';
> 
>   Database.TransactionLog.LogFiles.Add(LogFile);
> 
>   { Add the database }
> 
>   SQLServer.Databases.Add(Database);
> 
>   MsgBox('Added database ''' + Database.Name + '''.', 
mbInformation, mb_Ok);
> 
>   { Setup some columns }
> 
>   IDColumn := CreateOleObject('SQLDMO.Column');
>   IDColumn.Name := 'id';
>   IDColumn.Datatype := 'int';
>   IDColumn.Identity := True;
>   IDColumn.IdentityIncrement := 1;
>   IDColumn.IdentitySeed := 1;
>   IDColumn.AllowNulls := False;
> 
>   NameColumn := CreateOleObject('SQLDMO.Column');
>   NameColumn.Name := 'name';
>   NameColumn.Datatype := 'varchar';
>   NameColumn.Length := '64';
>   NameColumn.AllowNulls := False;
> 
>   { Setup a table }
> 
>   Table := CreateOleObject('SQLDMO.Table');
>   Table.Name := 'authors';
>   Table.FileGroup := 'PRIMARY';
> 
>   { Add the columns and the table }
> 
>   Table.Columns.Add(IDColumn);
>   Table.Columns.Add(NameColumn);
> 
>   Database.Tables.Add(Table);
> 
>   MsgBox('Added table ''' + Table.Name + '''.', mbInformation, 
mb_Ok);
> end;
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf
> Of Warrick Wilson
> Sent: Friday, June 03, 2005 4:10 AM
> To: [email protected]
> Subject: Re: [delphi-en] Working with Instances in Delphi 
(checking if they
> exist and installing them)
> 
> 
> --- Jason Fischer <[EMAIL PROTECTED]> wrote:
> 
> > Hi All,
> >
> > I have an install program that needs to install an
> > instance of MSDE
> > 2000.
> > I need a good way to test if the instance is already
> > there (a set user
> > name and password are used to create and access the
> > DB). If it is
> > there, I will be creating a DB on the instance (no
> > problem with this)
> > but if the instance is not there then I need to
> > install a new instance
> > and then do the DB create.
> >
> > So what I need is a way to test if the instance I
> > want exists, if I
> > can access it using my set user name and password.
> 
> Can you look for information in the registry to
> determine whether the product is installed at first?
> Then, if it is, you can probably retrieve a directory
> where to look for the database you might want, and
> then trace there to look for your database.
> 
> Are you writing your own installer? There's a free one
> that I've seen a lot of Delphi users talk about -
> InnoSetup or something like that. (I don't use it - we
> use InstallShield DevStudio at work, and I use the
> above method to check for previous installs of software).
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> 
> 
> 
> -------------------------------------------------------------------
---------
> ----
> Yahoo! Groups Links
> 
>   a.. To visit your group on the web, go to:
>   http://groups.yahoo.com/group/delphi-en/
> 
>   b.. To unsubscribe from this group, send an email to:
>   [EMAIL PROTECTED]
> 
>   c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> 
> 
> 
> 
> [Non-text portions of this message have been removed]




-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to