Sql Server 2005 Express Edition的连接字符串 [英] Connection String for Sql Server 2005 Express Edition

查看:77
本文介绍了Sql Server 2005 Express Edition的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中使用SQL Server 2005数据库,即:用于网站和Windows应用程序.现在我想要两个连接字符串;一个用于Windows应用程序,另一个用于我的网站.

我的数据库托管在: www.xyz.com

1.我想将我的网站托管在一个用ASP.NET完成的Web服务器上.那么连接字符串将是什么.

我用它作为我网站的连接字符串:
数据源=.\ SQLEXPRESS; AttachDBFilename = | DataDirectory | Test.mdf;集成安全性= SSPI;
并且在我的本地计算机上运行良好,但是当我将其托管在Web服务器中时,会出现以下错误:

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:SQL网络接口,错误:26-查找指定的服务器/实例时出错)


2.我的SQL数据库在Web服务器中.我想使用vb.net从我的本地计算机通过Windows窗体应用程序将其连接.那么,这个的连接字符串是什么.

我不知道该怎么办.
请有人告诉我什么是正确的连接字符串.

I want to use SQL Server 2005 Database in my application, i.e: for a website and a windows application. Right now I want two connection string; one for windows application and the other for my website.

My database is hosted in let''s say: www.xyz.com

1. I want to host my website on a web server which is done in ASP.NET. So what will be the connection string for that.

I used this as the connection string for my website:
Data source=.\SQLEXPRESS;AttachDBFilename=|DataDirectory|Test.mdf;Integrated Security=SSPI;
and it worked fine in my local computer but when I hosted it in the web server the following error arises:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)


2. My SQL Database is in the web server. I want to connect it through windows forms application from my local computer using vb.net. So what will be the connection string for this.

I could not understand what to do.
Please someone tell me what will be the correct connection string.

推荐答案

在SQl Server Configuration Manager中,选择"SqlServer网络连接","SqlExpress协议",启用TCP/IP. />
还要在Sql Server Services中检查SqlExpress实例的名称是什么.可能是另一个名字
In SQl Server Configuration Manager choose SqlServer Network Connection, Protocols for SqlExpress, enable TCP/IP.

Also check in Sql Server Services what the name of the SqlExpress Instance is. It might be another name


请参见
http://www.connectionstrings.com [ ^ ]
和创建连接字符串的其他简单方法,请使用以下步骤


see
http://www.connectionstrings.com[^]
and other simple way to create connection string use these steps


For connectivity in visual studio 
open Server Explorer
right click add Connection
Follow simple steps
After Creating Connection Right click on Database//Solve error if any
Click on properties
In Proprties Connection String will be found.
Copy This String.



检查您是否允许远程连接,请参见
将SQL Server 2005配置为允许远程连接



Check you have allowed remote connection see
configure SQL Server 2005 to allow remote connections


这篇关于Sql Server 2005 Express Edition的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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