简体   繁体   English

使用SQL Server数据库的ClickOnce应用程序

[英]ClickOnce application using SQL Server database

I'm trying to learn how to create a simple application using Visual Studio IDE in C#. 我正在尝试学习如何使用C#中的Visual Studio IDE创建一个简单的应用程序。

I wrote a little application that uses a local SQL Server database for reading and storing data. 我编写了一个小应用程序,该应用程序使用本地SQL Server数据库读取和存储数据。 On my machine, the program seems to work normally, but when trying to install the application on client computer it seems unable to read from the database. 在我的机器上,该程序似乎正常运行,但是当尝试在客户端计算机上安装该应用程序时,似乎无法从数据库中读取该程序。

I've tried to include the following prerequisites to the publish properties but it doesn't work: 我尝试将以下先决条件包括在publish属性中,但它不起作用:

  • Microsoft .NET Framework 4.5.2 Microsoft .NET Framework 4.5.2
  • SQL Server 2012 Express LocalDB SQL Server 2012 Express本地数据库

Any ideas about the right way to do it? 关于正确方法的任何想法?

Thanks to all. 谢谢大家。

You need to install SQL Server Express LocalDB (SqlLocalDB.MSI) on the computer you are deploying your ClickOnce application to. 您需要在将ClickOnce应用程序部署到的计算机上安装SQL Server Express LocalDB(SqlLocalDB.MSI)。

Selecting "SQL Server Express LocalDB" in the Prerequisites window and using "Download prerequisites from the component vendor's web site" should take care of that: 在“先决条件”窗口中选择“ SQL Server Express LocalDB”,并使用“从组件供应商的网站下载先决条件”应注意以下事项:

在此处输入图片说明

If you do that it should install the LocalDB for you and any database errors are more than likely resulting from connection string errors or leaving Integrated Security enabled. 如果这样做,它将为您安装LocalDB,并且任何数据库错误很可能是由连接字符串错误或启用Integrated Security

You need to test on a target computer which does not have "SQL Server Express LocalDB" installed and verify that after the ClickOnce deployment it is installed. 您需要在未安装“ SQL Server Express LocalDB”的目标计算机上进行测试,并验证在ClickOnce部署之后是否已安装它。 This will confirm that the problem is not the missing prerequisites but the database access issues... 这将确认问题不是缺少先决条件,而是数据库访问问题...

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM