y********o 发帖数: 2565 | 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里面还是不能连接成功? |
N********n 发帖数: 8363 | 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里面还是不能连接成功?
|
y********o 发帖数: 2565 | 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'.
|
N********n 发帖数: 8363 | 4 I think just your computer name, it's on the 1433 port right?
【在 y********o 的大作中提到】 : 是不是这个: : MyComputerName\SQLSERVER2005 (SQL Server 9.0.1406) : ?
|
y********o 发帖数: 2565 | 5 Isn't it 445?
【在 N********n 的大作中提到】 : I think just your computer name, it's on the 1433 port right?
|
N********n 发帖数: 8363 | 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?
|
y********o 发帖数: 2565 | 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.
|
N********n 发帖数: 8363 | 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洞口也凿开试试。
|
N********n 发帖数: 8363 | 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
|
y********o 发帖数: 2565 | 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
|
c**e 发帖数: 2558 | 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洞口也凿开试试。
|
y********o 发帖数: 2565 | 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
|