如何使用 Inno Setup 安装 SQL Server 2008 Express?

发布于 2024-07-11 07:36:23 字数 81 浏览 6 评论 0原文

有人有安装 SQL Server 2008 Express、为应用程序设置数据库并最终安装客户端 .NET WinForm 应用程序的脚本或过程吗?

anyone have script or procedures to install SQL Server 2008 Express, set up the database for the app and finally install a client .NET WinForm application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只等公子 2024-07-18 07:36:23

在这种依赖第三方产品 (SQL Server Express) 的情况下,我倾向于使用命令行驱动的安装(直接在 cmd 文件中或从“正确的”安装工具调用)。 此站点向您展示如何从命令行安装 Express,然后您可以使用 SQL Express用于创建对象的实用程序。 这种方法受到了微软的“祝福”。

有时,最简单的解决方案是最好的,即使这意味着让我的产品的用户在运行我的安装之前单独安装 SQL Express。 好吧,无论如何,对我来说是最好的:-)

In situations like this where I'm relying on third-party products (SQL Server Express), I tend to use command-line driven installs (either directly in a cmd file or called from a 'proper' install tool). This site shows you how to install Express from the command line, then you can use the SQL Express utility for object creation. This method is 'blessed' by Microsoft.

Sometimes the simplest solution is the best, even if that means getting the user of my product to install SQL Express separately before running my install. Well, best for me, anyway :-)

人间☆小暴躁 2024-07-18 07:36:23

以下脚本将检查 SQL Server 2008 R2 的完整版本。 如果已安装完整版本,则会跳过安装 SQL Server。 如果未安装完整版本,则会检查 SQL Express 版本。 如果已经安装,则跳过安装。 如果未安装,则会安装 SQL Express 2008 R2。

  1. 创建一个新脚本。 我们将其命名为 sql2008express.iss 并包含以下内容

    <前><代码>[自定义消息]

    sql2008r2expressx86_title=Microsoft SQL Server 2008 R2 Express 版 x86(包括工具)
    sql2008r2expressx64_title=Microsoft SQL Server 2008 R2 Express 版 x64(包括工具)

    sql2008r2expressx86_size=235.5 MB
    sql2008r2expressx64_size=247.5 MB

    [代码]

    常量
    sql2008r2expressx86_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x86_ENU.exe';
    sql2008r2expressx64_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x64_ENU.exe';

    过程 sql2008express();

    变量
    版本:字符串;

    开始
    // 检查是否安装了SQL Server 2008 R2完整版本
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLSERVER\MSSQLServer\CurrentVersion', 'CurrentVersion', 版本);
    if (version < '10.5') or (version = '') then begin
    // 如果未找到完整版本,则检查 Express 版本
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion', 'CurrentVersion', 版本);
    if (version < '10.5') (*or (version > '9.00') or (version = '') *) then begin
    如果 isX64() 那么
    AddProduct('SQLEXPRWT_x64_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=安装 /FEATURES=SQL,AS,RS,IS,工具 /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators “ /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=自动 /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx64_title'), CustomMessage('sql2008r2expressx64_size'), sql2008r2expressx64_url,false,false)
    别的
    AddProduct('SQLEXPRWT_x86_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=安装 /FEATURES=SQL,AS,RS,IS,工具 /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators “ /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=自动 /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx86_title'), CustomMessage('sql2008r2expressx86_size'), sql2008r2expressx86_url,false,false);
    结尾;
    结尾;
    结尾;

  2. 在您的脚本中,只需将脚本包含在[Run]标记中,并在[Code]标记中调用先前创建的脚本,如下所示:< /p>

    <前><代码>[运行]
    `#include“脚本\sql2008express.iss”
    [代码]
    sql2008express();

其他注意事项:
- 如果在同一文件夹中找到 SQL 安装工具包,则它将使用它们,如果没有,将从 Internet 下载它们。
- 抱歉,格式化了,它不起作用。 将其复制/粘贴到文本编辑器中并设置格式。 它已经完成并且可以工作了。

我希望这对其他人也有帮助。 :)

The following script will check for the full version of SQL Server 2008 R2. If full version is already installed, then it skips installing the SQL Server. If the full version is not installed, then it checks for the SQL Express edition. If it is already installed, it will skip the installation. If it is not installed, then it will install SQL Express 2008 R2.

  1. Create a new script. Let's name it sql2008express.iss with the following content

    [CustomMessages]
    
    sql2008r2expressx86_title=Microsoft SQL Server 2008 R2 Express Edition x86 (Including Tools)
    sql2008r2expressx64_title=Microsoft SQL Server 2008 R2 Express Edition x64 (Including Tools)
    
    sql2008r2expressx86_size=235.5 MB
    sql2008r2expressx64_size=247.5 MB
    
    [Code]
    
    const
    sql2008r2expressx86_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x86_ENU.exe';
    sql2008r2expressx64_url='http://download.microsoft.com/download/5/5/8/558522E0-2150-47E2-8F52-FF4D9C3645DF/SQLEXPRWT_x64_ENU.exe';
    
    procedure sql2008express();
    
    var
    version: string;
    
    begin
    // Check if the full version fo the SQL Server 2008 R2 is installed
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLSERVER\MSSQLServer\CurrentVersion', 'CurrentVersion', version);
    if (version < '10.5') or (version = '') then begin
    // If the full version is not found then check for the Express edition
    RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion', 'CurrentVersion', version);
    if (version < '10.5') (*or (version > '9.00') or (version = '') *) then begin
    if isX64() then
        AddProduct('SQLEXPRWT_x64_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL,AS,RS,IS,Tools /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators" /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=Automatic /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx64_title'), CustomMessage('sql2008r2expressx64_size'), sql2008r2expressx64_url,false,false)
    else
    AddProduct('SQLEXPRWT_x86_ENU.exe', '/QS /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL,AS,RS,IS,Tools /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\Network Service" /SQLSYSADMINACCOUNTS="builtin\Administrators" /INDICATEPROGRESS /TCPENABLED=1 /BROWSERSVCSTARTUPTYPE=Automatic /ERRORREPORTING=0 /SQMREPORTING=0 /SECURITYMODE=SQL /SAPWD=1234', CustomMessage('sql2008r2expressx86_title'), CustomMessage('sql2008r2expressx86_size'), sql2008r2expressx86_url,false,false);
            end;
        end;
    end;
    
  2. In your script then just include the script i nthe [Run] tag and call the previous created script in the [Code] tag like below:

    [Run]
    `#include "scripts\sql2008express.iss"
    [Code]
    sql2008express(); 
    

Other notes:
- If the setup kits for the SQL are found in the same folder then it will use them, if not, they will be downloaded from the Internet.
- Sorry for the formating, it doesn't work. Copy/paste it in a text editor and format it. It is complete and working.

I hope this will help others too. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文