安裝檔案怎麼寫?

來源:互聯網
上載者:User

; 指令碼用 Inno Setup 指令碼嚮導產生。
; 查閱文檔擷取建立 INNO SETUP 指令檔詳細資料!

[Setup]
AppName=科發醫院管理系統
AppVerName=科發醫院管理系統4.0
AppPublisher=廣州科發科技有限公司
AppPublisherURL=http://www.kf200.com
AppSupportURL=http://www.kf200.com
AppUpdatesURL=http://www.kf200.com
DefaultDirName={pf}/科發醫院資訊管理系統
DefaultGroupName=科發醫院管理系統
;LicenseFile=./Soruce/Program/Yygl/終端使用者許可協議.txt
Compression=bzip
SolidCompression=no

[Types]
Name: "full"; Description: "完整安裝"
Name: "custom"; Description: "自訂安裝"; Flags: iscustom

[Components]
Name: "program"; Description: "全部程式"; Types: Custom
;Name: "Program/His"; Description: "醫院管理資訊系統"; Types: full
                                                             ;//Custom
;//Name: "program/ClientSet"; Description: "用戶端"; Types: full
Name: "program/Kfpt"; Description: "二次開發平台"; Types: Custom
;Name: "program/Czsc"; Description: "操作手冊"; Types: Custom
                                                             ;//full Custom
Name: "program/ServerApp"; Description: "後台服務控制器"; Types: Custom
Name: "readme"; Description: "讀我檔案"; Types: full

[Tasks]
; 注意: 下面的條目包含一個中文用語 (“建立案頭捷徑”和“添加捷徑”)。如果需要你可以翻譯為其它語言。
Name: "desktopicon"; Description: "建立案頭捷徑"; GroupDescription: "添加捷徑:"; Flags: unchecked
                                                                                               ;//unchecked

[Files]
Source: "./Soruce/Program/kfpt/*"; DestDir: "{app}"; components :program/kfpt ;Flags: ignoreversion recursesubdirs
Source: "./Soruce/Program/ServerApp/*"; DestDir: "{app}"; components :program/ServerApp ;Flags: ignoreversion recursesubdirs
Source: "./Soruce/Data/*.*"; DestDir: "{drive:{app}}/Data"

; 注意: 不要在任何共用系統檔案中使用“Flags: ignoreversion”

[Icons]
Name: "{group}/後台服務控制器"; Filename: "{app}/ServerApp.exe" ;WorkingDir: "{app}" ;components :program/ServerApp
Name: "{group}/二次開發平台"; Filename: "{app}/KfPt.exe" ;WorkingDir: "{app}" ;components :program/kfpt
; 注意: 下面的條目包含一個中文用語 (“卸載”)。如果需要你可以翻譯為其它語言。
Name: "{group}/卸載 科發醫院管理系統"; Filename: "{uninstallexe}"

[Run]
; 注意: 下列條目包含一個中文用語 (“運行”)。如果需要你可以翻譯為其它語言。

[Code]

{--- SQLDMO ---}

const
  SQLServerName = '(local)';
  SQLDMOGrowth_MB = 0;

procedure InstallDb();
var
  SQLServer, Database, DBFile, LogFile: Variant;
  IDColumn, NameColumn, Table: Variant;
  FlagDbExist:Boolean;
  FileName1, Filename2,DbName,DbPath:String;

begin
  //;if MsgBox('安裝程式現在將通過一個可信任的串連到 Microsoft SQL 伺服器 ''' + SQLServerName + ''' 並建立一個資料庫。你想繼續嗎?', mbInformation, mb_YesNo) = idNo then
  //  Exit;

  { 建立主 SQLDMO COM 自動操作對象 }

  try
    SQLServer := CreateOleObject('SQLDMO.SQLServer');
  except
    RaiseException('未安裝資料庫伺服器,先請安裝 Microsoft SQL Server 服務器。'#13#13'(Error ''' + GetExceptionMessage + ''' occurred)');
    exit;
  end;

  { 串連到 Microsoft SQL 伺服器 }
  DbName:='KfHis_std_a';
  //私營版

  SQLServer.LoginSecure := True;
  SQLServer.Connect(SQLServerName);

  //MsgBox('已串連到 Microsoft SQL 伺服器 ''' + SQLServerName + '''.', mbInformation, mb_Ok);

  { 安裝資料庫 }
  FlagDbExist:=True;
  Database := CreateOleObject('SQLDMO.Database');
  try
    Database := SQLServer.Databases.Item(DbName);
  except

    FlagDbExist:=False;
  end;
  if FlagDbExist=False then

  else
    exit;  {資料庫已安裝}

  FileName1:= ExpandConstant('{drive:{app}}/Data')+'/KFHIS.mdf';
  Filename2:= ExpandConstant('{drive:{app}}/Data')+'/KFHIS_log.ldf';
  {附加資料庫}
  dbPath:= FileName1+' , '+Filename2;
  try
    SQLServer.AttachDB(DBName, dbPath);
  except
    MsgBox('資料庫安裝失敗!', mbInformation, mb_Ok);
    exit;
  end;
  MsgBox('資料庫安裝成功!', mbInformation, mb_Ok);
end;

function InitializeSetup(): Boolean;
begin
 { MsgBox('aa', mbInformation, mb_Ok); }
  Result:=True;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
{ if CurPageID=wpInfoAfter then
 begin
   MsgBox('pageid'+inttostr(CurPageID),mbInformation, mb_Ok);
   InstallDb();
 end;   }
 Result:=True;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep=ssPostInstall then
  begin
    InstallDb();
    CreateDir(ExpandConstant('{app}/Datalink'));
    FileCopy(ExpandConstant('{app}/DefLink.udl'),ExpandConstant('{app}/Datalink/DefLink.udl'),True);

  end;
end;

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.