[英]how to create exe for c# desktop application
I am trying to create setup file for my desktop application. 我正在尝试为我的桌面应用程序创建安装文件。 I am using SQL Server Express as database and c# as programming language.
我使用SQL Server Express作为数据库,使用c#作为编程语言。 I searched about creating the setup file but i am having some doubts... I have written the code to connect to the database in a class and called it wherever it is needed.
我搜索了有关创建安装文件的信息,但我有一些疑问……我编写了连接类中的数据库的代码,并在需要的地方进行了调用。
the code for creating connection is.. 用于创建连接的代码是..
class dbConnection
{
SqlConnection con;
public SqlConnection doConnection()
{
try
{
String str = "Data Source=Basu-Pc\\SQL;Initial Catalog=PhoenixIS;Integrated Security=True;Pooling=False";
con = new SqlConnection(str);
con.Open();
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
return con;
}
}
I call this class where ever I need it....and now I have some questions: 我在需要的地方都叫这门课....现在我有一些问题:
please help me get answer to my questions... 请帮助我回答我的问题...
You can create a setup project as in this link: 您可以按照以下链接创建安装项目:
create setup project step by step 逐步创建安装项目
About the sql connection string, you just need to create a .ini file and read that file in your program as in this link . 关于sql连接字符串,您只需要创建一个.ini文件并按此链接中的程序读取该文件。
If you want to deploy sql express, just add the db file as resource in setup project. 如果要部署sql express,只需在安装项目中将db文件添加为资源。
HTH. HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.