您的位置:首页 > 数据库

Installshield2010 实现web部署和数据库安装示例

2010-05-25 19:58 621 查看
 Installshield2010 实现web部署和数据库安装示例 收藏

在前面两篇文章中,介绍了如何利用Installshield集成Framework在安装程序中。

http://blog.csdn.net/downmoon/archive/2010/04/16/5494032.aspx

http://blog.csdn.net/downmoon/archive/2010/02/27/5330935.aspx

今天做了下web部署和简单数据库的安装,部署过程没有编写一行代码,堪称傻瓜化。现将部署过程演示如下:
在vs2010 中,新建一Web Application,如下图:

 


在InstallShield2010中新建一项目,如图:



 再IIS中新建一站点,可以用默认80端口,也可以自定义。





 在该站点下新建一应用程序,注意也可以是虚拟目录。

 




OK!下来是数据库部署,在上面的数据库项目中直接新建一SQL:

内容如下:

view plaincopy to clipboardprint?

-- =============================================   

---- Script Template   

-----Generate By downmoon(邀月),3w@live.cn   

-- =============================================   

--Create database   

if exists(select * from master.dbo.sysdatabases where name = 'Demo2010_InstallShield')   

    begin  

        drop database Demo2010_InstallShield   

    end  

else  

    begin  

        Create database Demo2010_InstallShield   

    end  

go   

Use Demo2010_InstallShield   

go   

--Create table   

IF EXISTS (SELECT * FROM sys.tables           

            WHERE name = 'Demo2010_InstallShield_DemoTable')   

        DROP TABLE Demo2010_InstallShield_DemoTable;   

GO   

CREATE TABLE Demo2010_InstallShield_DemoTable   

(col1 int IDENTITY,   

 col2 datetime,   

 col3 char(10)   

 );   

GO   

--Insert into Demo Data   

DECLARE @num int   

SET @num = 1   

WHILE @num < 1000   

BEGIN  

  INSERT INTO Demo2010_InstallShield_DemoTable   

    SELECT GETDATE(), 'my message';   

  SET @num = @num + 1;   

END;   

GO   

----Select * from Demo2010_InstallShield_DemoTable;  

-- =============================================
---- Script Template
-----Generate By downmoon(邀月),3w@live.cn
-- =============================================
--Create database
if exists(select * from master.dbo.sysdatabases where name = 'Demo2010_InstallShield')
begin
drop database Demo2010_InstallShield
end
else
begin
Create database Demo2010_InstallShield
end
go
Use Demo2010_InstallShield
go
--Create table
IF EXISTS (SELECT * FROM sys.tables
WHERE name = 'Demo2010_InstallShield_DemoTable')
DROP TABLE Demo2010_InstallShield_DemoTable;
GO
CREATE TABLE Demo2010_InstallShield_DemoTable
(col1 int IDENTITY,
col2 datetime,
col3 char(10)
);
GO
--Insert into Demo Data
DECLARE @num int
SET @num = 1
WHILE @num < 1000
BEGIN
INSERT INTO Demo2010_InstallShield_DemoTable
SELECT GETDATE(), 'my message';
SET @num = @num + 1;
END;
GO
----Select * from Demo2010_InstallShield_DemoTable;

在 installShield中新增一SQL,如图:


 


 

 可以设置数据库的相关选项,例如版本,可以手工指定。

 

 

 OK!基本完成了!欣赏一下部署过程和成果吧!

 



 


 

修改SQL Server后,

 


 




 


 


 总结:

1、 注意installshield2010目前版本为sp1 with hotfix 52410,还不支持Framewrok 4的IIS站点的部署,非常遗憾!不过期待新版本!^_^

2、注意此安装程序在卸载时,如果数据库连接不上,会提示出错而终止卸载程序,当然可以在制作安装程序时设置为“出错则自动跳到下一步”而修改默认配置。





另外,可以直接在vs2010中新建Installshield类型的项目,操作比较类似,在些略去,在兴趣的朋友可以一试。



邀月注:本文版权由邀月和CSDN共同所有,转载请注明出处。
助人等于自助!   3w@live.cn
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐