Redian新闻
>
Problem connecting to SQL Server
avatar
Problem connecting to SQL Server# DotNet - 窗口里的风景
y*o
1
我用这个connection string, 不能从我的web application连到SQL Server.
"Data Source=localhost;Initial Catalog=MyWebAPPdb; User Id=usrnm; Password=w
odemima;";
但是可以用usrnm和wodemima从Management Studio用SQL Server Authentication模式成
功登录并浏览MyWebAPPdb数据库的表格,以及做其他操作。
我已经启用了SQL Server Authentication和Windows Authentication两种模式了,缘何
从web application里面还是不能连接成功?
avatar
N*n
2

What's the name of your sql server? Put it in the above data source
and remove that 'localhost'.

【在 y********o 的大作中提到】
: 我用这个connection string, 不能从我的web application连到SQL Server.
: "Data Source=localhost;Initial Catalog=MyWebAPPdb; User Id=usrnm; Password=w
: odemima;";
: 但是可以用usrnm和wodemima从Management Studio用SQL Server Authentication模式成
: 功登录并浏览MyWebAPPdb数据库的表格,以及做其他操作。
: 我已经启用了SQL Server Authentication和Windows Authentication两种模式了,缘何
: 从web application里面还是不能连接成功?

avatar
y*o
3
是不是这个:
MyComputerName\SQLSERVER2005 (SQL Server 9.0.1406)
?

【在 N********n 的大作中提到】
:
: What's the name of your sql server? Put it in the above data source
: and remove that 'localhost'.

avatar
N*n
4
I think just your computer name, it's on the 1433 port right?

【在 y********o 的大作中提到】
: 是不是这个:
: MyComputerName\SQLSERVER2005 (SQL Server 9.0.1406)
: ?

avatar
y*o
5
Isn't it 445?

【在 N********n 的大作中提到】
: I think just your computer name, it's on the 1433 port right?
avatar
N*n
6
I don't know about express. Standard sql server is default on 1433.
If yours is on 445, then make "mycomputername,445" your data source.

【在 y********o 的大作中提到】
: Isn't it 445?
avatar
y*o
7
我用了我的电脑名字加SQL Server名字,现在症状不一样了。瞧:
An error has occurred while establishing a connection to the server. When c
onnecting to SQL Server 2005, this failure may be caused by the fact that un
der the default settings SQL Server does not allow remote connections. (prov
ider: Named Pipes Provider, error: 40 - Could not open a connection to SQL S
erver)
哦,yes, mine is express. 那我干脆从在防火墙上将1433洞口也凿开试试。

【在 N********n 的大作中提到】
: I don't know about express. Standard sql server is default on 1433.
: If yours is on 445, then make "mycomputername,445" your data source.

avatar
N*n
8
Just use your computer name without the sql server name. Do it in
this format "yourComputerName,port_number".

c
un
prov
S

【在 y********o 的大作中提到】
: 我用了我的电脑名字加SQL Server名字,现在症状不一样了。瞧:
: An error has occurred while establishing a connection to the server. When c
: onnecting to SQL Server 2005, this failure may be caused by the fact that un
: der the default settings SQL Server does not allow remote connections. (prov
: ider: Named Pipes Provider, error: 40 - Could not open a connection to SQL S
: erver)
: 哦,yes, mine is express. 那我干脆从在防火墙上将1433洞口也凿开试试。

avatar
N*n
9

Since 127.0.0.1 is the address for localhost, you can use
"127.0.0.1, [sql_server_port]" as the data source. Sql server
configuration manager shows the port your server uses.

【在 N********n 的大作中提到】
: Just use your computer name without the sql server name. Do it in
: this format "yourComputerName,port_number".
:
: c
: un
: prov
: S

avatar
y*o
10
刚试了一下,不行,明天再做。先行谢过了。

【在 N********n 的大作中提到】
: Just use your computer name without the sql server name. Do it in
: this format "yourComputerName,port_number".
:
: c
: un
: prov
: S

avatar
c*e
11
by default, sql express is installed as a named instance.
in this case, the correct syntax for specifying Data Source is
either
localhost\sqlexpress
or
.\sqlexpress
you shouldn't need to specify a port number.

c
un
prov
S

【在 y********o 的大作中提到】
: 我用了我的电脑名字加SQL Server名字,现在症状不一样了。瞧:
: An error has occurred while establishing a connection to the server. When c
: onnecting to SQL Server 2005, this failure may be caused by the fact that un
: der the default settings SQL Server does not allow remote connections. (prov
: ider: Named Pipes Provider, error: 40 - Could not open a connection to SQL S
: erver)
: 哦,yes, mine is express. 那我干脆从在防火墙上将1433洞口也凿开试试。

avatar
y*o
12
楼上两位兄台,多谢了。
我在用.NetTiers生成的code template, 是从公司的工作站上做的,需要在web.config
里面将有关.nettiers的connection string 也一并修改方可。
是我疏忽了,今日一觉醒来方意识到此问题。如此疏忽大意,再再不可饶恕。

【在 c**e 的大作中提到】
: by default, sql express is installed as a named instance.
: in this case, the correct syntax for specifying Data Source is
: either
: localhost\sqlexpress
: or
: .\sqlexpress
: you shouldn't need to specify a port number.
:
: c
: un

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。