简体   繁体   English

如何在Visual Studio 2008和SQL Server 2012中创建.exe文件

[英]How to create .exe file in Visual Studio 2008 and SQL Server 2012

How to create .exe file in Visual Studio 2008 and SQL Server 2012? 如何在Visual Studio 2008和SQL Server 2012中创建.exe文件? I am trying to create an .exe file for my C# Windows application, I am using microsoft SQL Server Management Studio 2012 as database. 我正在尝试为C#Windows应用程序创建一个.exe文件,我正在使用Microsoft SQL Server Management Studio 2012作为数据库。

Then only I can run my application in another machine also. 然后,只有我才能在另一台计算机上运行我的应用程序。

Thanks in advance... 提前致谢...

  1. Create a new project 创建一个新项目
  2. Specify Console Application or Windows Forms Application or any other "Application" 指定控制台应用程序或Windows窗体应用程序或任何其他“应用程序”
  3. Write you code. 写你的代码。
  4. Compile your code. 编译代码。 This will create an exe. 这将创建一个exe。

Note: You probably need to build an installer or deployment package and not just copy over the exe to another computer because there may be missing dependencies. 注意:您可能需要构建安装程序或部署程序包,而不仅仅是将exe复制到另一台计算机,因为可能缺少依赖项。

It may help you to read a "getting started in Visual Studio" tutorial. 它可以帮助您阅读“ Visual Studio入门”教程。

Cheers. 干杯。

We can implement auto attach database just use the connection string following. 我们可以使用下面的连接字符串来实现自动附加数据库。

1) Add a folder named ”DB” to the project, and copy the database file into it after you detach it from your sql server. 1)在项目中添加一个名为“ DB”的文件夹,然后将其与sql server分离,然后将数据库文件复制到其中。

2) Change your connection string like this: 2)像这样更改您的连接字符串:

<connectionStrings>
    <add name="WindowsFormsApplication1.Properties.Settings.BabakConnectionString"
        connectionString="Data Source=.;AttachDbFilename=|DataDirectory|\DB\DataBase1.mdf;Initial Catalog=test;Integrated Security=True"
        providerName="System.Data.SqlClient" />
</connectionStrings>

3) After these, the database file will auto attach to the sql server when you run your application, and the database name is “test”, you can open the sql server management studio to find it. 3)之后,运行应用程序时,数据库文件将自动附加到sql服务器,并且数据库名称为“ test”,您可以打开sql server management studio进行查找。

In addition, you can find the connection in the app.config file through the solution explorer in vs2010. 此外,您可以通过vs2010中的解决方案资源管理器在app.config文件中找到连接。 And you also can find this file under your project. 您也可以在项目下找到该文件。 With these information, you can find it and modify it. 有了这些信息,您就可以找到并修改它。

您可以在项目的工作文件夹中看到您的EXE文件。打开工作文件夹> Bin> Debug> Exe文件将存在。首先构建您的解决方案

不要让任何人傻瓜,在Visual Studio 2013和2012中都可以选择创建应用程序的安装向导

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用InstallShield LE为带有SQL Server 2012本地数据库的Visual Studio 2012 Windows窗体应用程序创建setup.exe文件 - How to create a setup.exe file using InstallShield LE for a Visual Studio 2012 Windows Forms Application with SQL Server 2012 Local Database SQL Server 2008和Visual Studio 2012 - SQL Server 2008 and Visual Studio 2012 在 Visual Studio 2008 中连接到 SQL Server 2012 数据库 - Connecting to a SQL Server 2012 database in Visual Studio 2008 错误948:带有SQL Server 2008 R2的Visual Studio 2012 - Error 948 :Visual Studio 2012 with SQL Server 2008 R2 生成Web.config以将数据从文件加载到Visual Studio 2012中的MS SQL 2008服务器数据库 - generate Web.config for loading data from a file to MS SQL 2008 server database in Visual Studio 2012 如何在Visual Studio 2013中创建安装程序/ exe,包括SQL Server数据库文件? - How to create setup/exe in Visual Studio 2013 including a SQL Server database file? 如何为visual studio 2012中创建的Windows服务创建EXE设置文件 - How to create EXE setup file for windows service created in visual studio 2012 无法从Visual Studio Express 2012创建SQL Server数据库 - Unable to create SQL Server database from Visual Studio Express 2012 在Visual Studio 2012 Sql Server项目中创建一个非对称密钥 - Create an Asymmetric key in a Visual Studio 2012 Sql Server project 通过SQL Server Management Studio 2008连接数据库,但不通过Visual Studio 2012连接数据库 - connecting database through sql server management studio 2008 but not through visual studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM