如何创建到SQL Express 2005数据库的公共连接字符串? [英] How to create an common connection string to an SQL express 2005 database?

查看:100
本文介绍了如何创建到SQL Express 2005数据库的公共连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此刻,我的连接字符串已设置为我的SQL Server实例名称[我的计算机名称] \ SQLEXPRESS(用于数据源部分).其他人使用相同的实例名称的可能性很小.因此,我想知道如何创建公共连接字符串,以便将应用程序部署到任何计算机.

我创建了一个ODBC数据源,然后尝试使用我的应用程序连接到数据库.但是出现一个错误,表明无法连接到数据库,因为它不接受远程连接.

我将sql服务器设置为接受远程连接(名称管道和TCP/IP).我还将浏览器设置为sql服务器.但是我仍然无法通过我的应用程序连接到数据库-它给出了相同的远程连接错误.

那我该怎么办呢?请帮忙!!!!

At the moment my connection string is set to my SQL server instance name [My Computer name]\SQLEXPRESS (for the data source part). It''s unlikely that other people would have the same instance name. So I want to know how to create a common connection string so I can deploy my application to any computer.

I created an ODBC data source and then tried to connect to the database using my application. But there was an error saying that it''s not possible to connect to the database because it''s not accepting remote connections.

I set the sql server to accept remote connections (both names pipes and TCP/IP). I also set the sql server browsing on. But I still cant connect to the database via my application - it gives the same remote connection error.

So how do I do it? Please help!!!!

推荐答案

写道:​​

所以我想知道如何创建公共连接字符串,以便可以将应用程序部署到任何计算机.

So I want to know how to create a common connection string so I can deploy my application to any computer.



你不能您可以使用localhost/SQLEXPRESS来运行具有实例SQLEXPRESS的任何计算机,但是如果您想要更大的灵活性,则需要允许用户编辑其连接字符串.



You can''t. You can use localhost/SQLEXPRESS to work for any computer that has an instance named SQLEXPRESS, but if you want more flexibility than that, you need to allow the user to edit their connection string.


您正在使用哪个版本的SQL Express?
SQL Express确实允许远程连接,但默认情况下未启用.

为此,请打开SQL Server配置管理器,转到SQL Server网络配置-> SQL Exprees协议,启用TCP/IP.重新启动您的SQL Server,然后启动SQLBrowser服务.现在您应该能够远程连接到SQL Express
Which version of SQL Express are you using?.
SQL Express does allow remote connections but is not enabled by default.

To do this open SQL Server Configuration Manager, go to SQL Server Network Configuration -> Protocols for SQL Exprees, enable TCP/IP. Restart your SQL server and then start SQLBrowser service. Now you should be able to connect to SQL Express remotely


这篇关于如何创建到SQL Express 2005数据库的公共连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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