在ClickOnce和设置&中,SQL Server不存在或访问被拒绝部署项目 [英] SQL Server Doesnot Exist or Access Denied on ClickOnce and Setup & Deployment Projects

查看:71
本文介绍了在ClickOnce和设置&中,SQL Server不存在或访问被拒绝部署项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows应用程序,并且它在将VS.Net2008和SQL Server2005都安装在同一台计算机上的开发机中工作正常,但是当我尝试运行安装程序并尝试登录时,出现以下错误: SQL SERVER不存在或访问被拒绝. 我正在以PC管理员的身份运行安装程序和应用程序,目标操作系统是Windows 7和Windows XP,使用
C#.NET2008.
SQL Server2005作为数据库.
然后,我创建了一个设置,并在包含的条件中
.Net Framework3.5
.Net Framework3.5 SP1
Windows Installer 3.1
SQL Server Compact3.5
SQL Server 2005 Express Edition SP2(x86)
现在,我已将mdf和ldf文件复制到bin文件夹中,并使用连接字符串

I have a windows application and it working fine in development machine where VS.Net2008 and SQL Server2005 both are installed in same machine but when I'm trying to run the setup and try to login I get the error that SQL SERVER Doesnot Exist or Access Denied. I'm running the setup and the application as Administrator of the PC and target operating system is Windows 7 and Windows XP using
C#.NET2008.
SQL Server2005 as database.
Then I have created a setup and in the prequisites I have included
.Net Framework3.5
.Net Framework3.5 SP1
Windows Installer 3.1
SQL Server Compact3.5
SQL Server 2005 Express Edition SP2(x86)
Now I have copied the mdf and ldf files into bin folder and using a connection string

" 数据 Source =.\ SQLEXPRESS; AttachDbFilename = ResourceAllocation.mdf; Integrated Security = True; Connect Timeout = 30; User Instance = True "
以连接数据库.但是,如果我使用的是安装文件,则无法连接数据库文件.
为了避免出现任何问题,我禁用了防火墙和防病毒软件
我已经启动了SQL服务.
我什至建立了与TCP的远程连接.
请建议我如何建立连接.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=ResourceAllocation.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
to connect the database.But it is failing to connect the database file if I'm using the setup file.
I have diabled the firewall and antivirus in order to avoid any problem
I have started the services of SQL.
I have even made remote connection to TCP.
Please suggest me how to establish the connection.

推荐答案

如果您尝试在没有sql server的计算机上运行代码,

If you are trying to run your code on a machine that does not have sql server on it,

它将无法正常工作!

您必须在目标计算机上具有sql服务器,或者具有要连接的远程服务器,或者您可以使用本地数据库.

You have to have sql server on the target machine, or have a remote server to connect, or you can use a local data base.

但是对于最后一个选项,您将不得不返回代码并创建本地数据库(sdf文件).

But for the last option you will have to go back to your code and create a local data base (sdf file).

 

Noam B.


这篇关于在ClickOnce和设置&中,SQL Server不存在或访问被拒绝部署项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆