⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cs.old

📁 < SQL Server2005程序设计>
💻 OLD
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace Setup
{
    class Program
    {
        static void Main(string[] args)
        {
            EmbeddedInstall EI = new EmbeddedInstall();

            if (args.Length > 0)
            {
                int i = 0;
                while (i < args.Length)
                {
                    if ((string)args[i].ToUpper() == "-V")
                    {
                        string[] strInstanceArray = new string[0];
                        string[] strVersionArray = new string[0];
                        string[] strEditionArray = new string[0];

                        int iInstances = EI.EnumSQLInstances(ref strInstanceArray, ref strEditionArray, ref strVersionArray);
                        if (iInstances > 0)
                        {
                            for (int j = 0; j <= iInstances - 1; j++)
                            {
                                Console.WriteLine("SQL Server Instance: \"" + strInstanceArray[j].ToString() + "\" -- " + strEditionArray[j].ToString() + "   (" + strVersionArray[j].ToString() + ")");
                            }

                        }
                        else
                        {
                            Console.WriteLine("No instance of SQL Server Express found on local server.\n\n");
                        }

                        return;
                    }

                    if ((string)args[i].ToUpper() == "-I")
                    {
                        if (EI.IsExpressInstalled())
                        {
                            Console.WriteLine("An instance of SQL Server Express is installed.\n\n");
                        }
                        else
                        {
                            Console.WriteLine("There are no SQL Server Express instances installed.\n\n");
                        }

                        return;
                    }

                    i++;
                }
            }

            Console.WriteLine("\nInstalling SQL Server 2005 Express Edition\n");

            EI.AutostartSQLBrowserService = false;
            EI.AutostartSQLService = true;
            EI.Collation = "SQL_Latin1_General_Cp1_CS_AS";
            EI.DisableNetworkProtocols = false;
            EI.InstanceName = "SQLEXPRESS";
            EI.ReportErrors = true;
            EI.SetupFileLocation = "C:\\Downloads\\sqlexpr.exe";
            //Provide location for the Express setup file
            EI.SqlBrowserAccountName = ""; //Blank means LocalSystem
            EI.SqlBrowserPassword = ""; // N/A
            EI.SqlDataDirectory = "C:\\Program Files\\Microsoft SQL Server\\";
            EI.SqlInstallDirectory = "C:\\Program Files\\";
            EI.SqlInstallSharedDirectory = "C:\\Program Files\\";
            EI.SqlServiceAccountName = ""; //Blank means Localsystem
            EI.SqlServicePassword = ""; // N/A
            EI.SysadminPassword = "ThIsIsALoNgPaSsWoRd1234!!"; //<<Supply a secure sysadmin password>>
            EI.UseSQLSecurityMode = true;

            EI.InstallExpress();

            Console.WriteLine("\nInstalling custom application\n");


            //If you need to run another MSI install, remove the following comment lines 
            //and fill in information about your MSI

            /*Process myProcess = new Process();
            myProcess.StartInfo.FileName = "";//<<Insert the path to your MSI file here>>
            myProcess.StartInfo.Arguments = ""; //<<Insert any command line parameters here>>
            myProcess.StartInfo.UseShellExecute = false;
            myProcess.Start();*/

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -