首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

:小弟我用vs2005和sql 2005开发的windows应用程序怎么制作安装程序(打包)

2012-09-27 
请教高手:我用vs2005和sql 2005开发的windows应用程序如何制作安装程序(打包)?如题,数据库如何打包进去?在

请教高手:我用vs2005和sql 2005开发的windows应用程序如何制作安装程序(打包)?
如题,数据库如何打包进去?在另外一台机器上需要安装哪些文件?谢谢~~~~~~~~~~~~~~~

[解决办法]
在安装部署里 
添加“项目输出”,选择主输出和内容文件,确定后即产生“主输出来自(活动)”的字样,同时具有相关的依赖项文件。
通过执行SQL脚本配置数据库 
 
private void ExecuteSql(string DatabaseName , string Sql) 

SqlConnection sqlConnection1 = new SqlConnection("user id=" + strUser + ";password="+strPass+";database=master;server=(local)") ; 
SqlCommand Command = new SqlCommand(Sql, sqlConnection1); 
Command.Connection.Open(); 
Command.Connection.ChangeDatabase(DatabaseName); 

try 

Command.ExecuteNonQuery(); 

catch(Exception ex) 

throw ex; 

finally 

Command.Connection.Close(); 
}

安装部署

热点排行