VB .net服务无法连接到sql 2000 [英] VB .net Service cannot connect to sql 2000

查看:63
本文介绍了VB .net服务无法连接到sql 2000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我已经把这个问题搁置一边了。


我在win2k服务器上安装了vb .net服务。我正在尝试

让它连接到sql 2000框但我收到此错误:


建立与服务器的连接时发生错误。

当连接到SQL Server 2005时,这个失败可能是由于在默认设置下SQL Server不允许远程

连接。 (提供者:命名管道提供者,错误:40 - 无法

打开与SQL Server的连接)


我在sql2000上打开了远程连接。我已经尝试了

以下连接字符串


data source =< IP> ;;初始目录= dfcdb; persist security info = False; user

id = user;密码= PW;数据包大小= 4096

数据源=(本地);初始目录= dfcdb;持久安全

info = False; user id = user; password = PW; packet size = 4096

data source = tcp:< IP> ;; initial catalog = dfcdb; persist security

info = False; user id = user; password = PW; packet size = 4096

data source =< IP> ;:1433; initial catalog = dfcdb; persist安全

info = False;用户ID =用户;密码= PW;包大小= 4096(该端口是

打开)


该服务设置为在我的登录下运行。


我制作了一个测试连接字符串的Windows应用程序和第一个3

工作。我在本地机器上使用本地sql 2000测试了该服务,并且

它就像一个冠军。


这是打开连接的.net代码


''1。创建连接

Dim SQLString As String = My.Settings.SQLConnectionString

Dim cn As New SqlConnection(SQLString)

cn .Open()< - 我认为它在这里打破了

''2。创建命令对象,传入SQL字符串

Const selectString As String =" GetRules"

Dim cmd As SqlCommand

cmd = New SqlCommand(selectString,cn)

cmd.CommandType = CommandType.StoredProcedure


Dim reader As SqlDataReader = cmd.ExecuteReader()

>
请帮助我到处寻找

Ok guys I have racked my brain on this one.

I have a vb .net service installed on a win2k server. I am trying to
get it to connect to sql 2000 box but I get this error:

An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)

I have remote connection turned on, on the sql2000. I have tried the
following connection strings

data source=<IP>;initial catalog=dfcdb;persist security info=False;user
id=user;password=PW;packet size=4096

data source=(local);initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=tcp:<IP>;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=<IP>:1433;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096 (that port is
open)

The service is set to run under my log on.

I made a windows app that tests connection strings and the first 3
work. I tested the service on a local machine with a local sql 2000 and
it works like a champ.

Here is the .net code to open the connection

''1. Create a connection
Dim SQLString As String = My.Settings.SQLConnectionString
Dim cn As New SqlConnection(SQLString)

cn.Open() <-- I think it breaks here
''2. Create the command object, passing in the SQL string
Const selectString As String = "GetRules"
Dim cmd As SqlCommand
cmd = New SqlCommand(selectString, cn)
cmd.CommandType = CommandType.StoredProcedure

Dim reader As SqlDataReader = cmd.ExecuteReader()

please help I have looked everywhere

推荐答案

您是否确保连接可以通过防火墙?

< bl ********* @ gmail.com写信息

新闻:11 ************** *******@38g2000cwa.googlegrou ps.com ...
Have you made sure that the connection can get through your firewall?
<bl*********@gmail.comwrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...

好​​的家伙,我已经把我的大脑放在了这个上面。


我在win2k服务器上安装了vb .net服务。我正在尝试

让它连接到sql 2000框但我收到此错误:


建立与服务器的连接时发生错误。

当连接到SQL Server 2005时,这个失败可能是由于在默认设置下SQL Server不允许远程

连接。 (提供者:命名管道提供者,错误:40 - 无法

打开与SQL Server的连接)


我在sql2000上打开了远程连接。我已经尝试了

以下连接字符串


data source =< IP> ;;初始目录= dfcdb; persist security info = False; user

id = user;密码= PW;数据包大小= 4096

数据源=(本地);初始目录= dfcdb;持久安全

info = False; user id = user; password = PW; packet size = 4096

data source = tcp:< IP> ;; initial catalog = dfcdb; persist security

info = False; user id = user; password = PW; packet size = 4096

data source =< IP> ;:1433; initial catalog = dfcdb; persist安全

info = False;用户ID =用户;密码= PW;包大小= 4096(该端口是

打开)


该服务设置为在我的登录下运行。


我制作了一个测试连接字符串的Windows应用程序和第一个3

工作。我在本地机器上使用本地sql 2000测试了该服务,并且

它就像一个冠军。


这是打开连接的.net代码


''1。创建连接

Dim SQLString As String = My.Settings.SQLConnectionString

Dim cn As New SqlConnection(SQLString)

cn .Open()< - 我认为它在这里打破了

''2。创建命令对象,传入SQL字符串

Const selectString As String =" GetRules"

Dim cmd As SqlCommand

cmd = New SqlCommand(selectString,cn)

cmd.CommandType = CommandType.StoredProcedure


Dim reader As SqlDataReader = cmd.ExecuteReader()

>
请帮助我到处看看
Ok guys I have racked my brain on this one.

I have a vb .net service installed on a win2k server. I am trying to
get it to connect to sql 2000 box but I get this error:

An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)

I have remote connection turned on, on the sql2000. I have tried the
following connection strings

data source=<IP>;initial catalog=dfcdb;persist security info=False;user
id=user;password=PW;packet size=4096

data source=(local);initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=tcp:<IP>;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=<IP>:1433;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096 (that port is
open)

The service is set to run under my log on.

I made a windows app that tests connection strings and the first 3
work. I tested the service on a local machine with a local sql 2000 and
it works like a champ.

Here is the .net code to open the connection

''1. Create a connection
Dim SQLString As String = My.Settings.SQLConnectionString
Dim cn As New SqlConnection(SQLString)

cn.Open() <-- I think it breaks here
''2. Create the command object, passing in the SQL string
Const selectString As String = "GetRules"
Dim cmd As SqlCommand
cmd = New SqlCommand(selectString, cn)
cmd.CommandType = CommandType.StoredProcedure

Dim reader As SqlDataReader = cmd.ExecuteReader()

please help I have looked everywhere



说实话我真的不太了解防火墙,我想

可能是问题所在。我需要设置它才能工作吗?

Matt Fielder写道:
To be honest I really don''t know much about firewalls and I think that
might be the problem. What would I need to set on it for it to work?
Matt Fielder wrote:

你确定连接可以得到通过你的防火墙?

< bl ********* @ gmail.comwrote in message

新闻:11 ********* ************@38g2000cwa.googlegrou ps.com ...
Have you made sure that the connection can get through your firewall?
<bl*********@gmail.comwrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...

好​​的家伙我已经把这个脑袋绞尽脑汁了。 br />

我在win2k服务器上安装了vb .net服务。我正在尝试

让它连接到sql 2000框但我收到此错误:


建立与服务器的连接时发生错误。

当连接到SQL Server 2005时,这个失败可能是由于在默认设置下SQL Server不允许远程

连接。 (提供者:命名管道提供者,错误:40 - 无法

打开与SQL Server的连接)


我在sql2000上打开了远程连接。我已经尝试了

以下连接字符串


data source =< IP> ;;初始目录= dfcdb; persist security info = False; user

id = user;密码= PW;数据包大小= 4096

数据源=(本地);初始目录= dfcdb;持久安全

info = False; user id = user; password = PW; packet size = 4096

data source = tcp:< IP> ;; initial catalog = dfcdb; persist security

info = False; user id = user; password = PW; packet size = 4096

data source =< IP> ;:1433; initial catalog = dfcdb; persist安全

info = False;用户ID =用户;密码= PW;包大小= 4096(该端口是

打开)


该服务设置为在我的登录下运行。


我制作了一个测试连接字符串的Windows应用程序和第一个3

工作。我在本地机器上使用本地sql 2000测试了该服务,并且

它就像一个冠军。


这是打开连接的.net代码


''1。创建连接

Dim SQLString As String = My.Settings.SQLConnectionString

Dim cn As New SqlConnection(SQLString)

cn .Open()< - 我认为它在这里打破了

''2。创建命令对象,传入SQL字符串

Const selectString As String =" GetRules"

Dim cmd As SqlCommand

cmd = New SqlCommand(selectString,cn)

cmd.CommandType = CommandType.StoredProcedure


Dim reader As SqlDataReader = cmd.ExecuteReader()

>
请帮助我到处查看
Ok guys I have racked my brain on this one.

I have a vb .net service installed on a win2k server. I am trying to
get it to connect to sql 2000 box but I get this error:

An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)

I have remote connection turned on, on the sql2000. I have tried the
following connection strings

data source=<IP>;initial catalog=dfcdb;persist security info=False;user
id=user;password=PW;packet size=4096

data source=(local);initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=tcp:<IP>;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=<IP>:1433;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096 (that port is
open)

The service is set to run under my log on.

I made a windows app that tests connection strings and the first 3
work. I tested the service on a local machine with a local sql 2000 and
it works like a champ.

Here is the .net code to open the connection

''1. Create a connection
Dim SQLString As String = My.Settings.SQLConnectionString
Dim cn As New SqlConnection(SQLString)

cn.Open() <-- I think it breaks here
''2. Create the command object, passing in the SQL string
Const selectString As String = "GetRules"
Dim cmd As SqlCommand
cmd = New SqlCommand(selectString, cn)
cmd.CommandType = CommandType.StoredProcedure

Dim reader As SqlDataReader = cmd.ExecuteReader()

please help I have looked everywhere


正如测试一样,看看这实际上是否是问题,只需禁用

防火墙完全用于测试 - 然后重新启用。一旦你弄清楚这是否是问题,你可以做一些关于如何允许通过所需访问的研究。其他人比我更了解这种类型的b $ b b安全性,所以我不想给出危险的建议。


对于快速测试,如果您运行内置于XP的防火墙,您可以通过控制面板获得




" blurryimage" < bl ********* @ gmail.comwrote in message

news:11 ********************* *@m30g2000cwm.googlegr oups.com ...
Just as a test to see if that is in fact the issue, just disable the
firewall entirely for a test - then re-enable. Once you''ve figured out if
that is the issue, you can do a little more research about how to allow just
the needed access through. Others know much more about this type of
security than I, so I don''t want to potentially give dangerous advice.

For the quick test, if your running the firewall built into XP, you can get
to it via control panel.

"blurryimage" <bl*********@gmail.comwrote in message
news:11**********************@m30g2000cwm.googlegr oups.com...

说实话,我真的不太了解防火墙,我认为

可能是问题所在。我需要为它设置什么才能设置它?


Matt Fielder写道:
To be honest I really don''t know much about firewalls and I think that
might be the problem. What would I need to set on it for it to work?
Matt Fielder wrote:

>你做过吗?确保连接可以通过你的防火墙吗?
< bl ********* @ gmail.comwrote in message
新闻:11 *********** **********@38g2000cwa.googlegro ups.com ...
>Have you made sure that the connection can get through your firewall?
<bl*********@gmail.comwrote in message
news:11*********************@38g2000cwa.googlegro ups.com...

好​​的家伙我已经把这个问题绞尽脑汁了。


我在win2k服务器上安装了vb .net服务。我正在尝试

让它连接到sql 2000框但我收到此错误:


建立与服务器的连接时发生错误。

当连接到SQL Server 2005时,这个失败可能是由于在默认设置下SQL Server不允许远程

连接。 (提供者:命名管道提供者,错误:40 - 无法

打开与SQL Server的连接)


我在sql2000上打开了远程连接。我已经尝试了

以下连接字符串


data source =< IP> ;;初始目录= dfcdb; persist security info = False; user

id = user;密码= PW;数据包大小= 4096

数据源=(本地);初始目录= dfcdb;持久安全

info = False; user id = user; password = PW; packet size = 4096

data source = tcp:< IP> ;; initial catalog = dfcdb; persist security

info = False; user id = user; password = PW; packet size = 4096

data source =< IP> ;:1433; initial catalog = dfcdb; persist安全

info = False;用户ID =用户;密码= PW;包大小= 4096(该端口是

打开)


该服务设置为在我的登录下运行。


我制作了一个测试连接字符串的Windows应用程序和第一个3

工作。我在本地机器上使用本地sql 2000测试了该服务,并且

它就像一个冠军。


这是打开连接的.net代码


''1。创建连接

Dim SQLString As String = My.Settings.SQLConnectionString

Dim cn As New SqlConnection(SQLString)

cn .Open()< - 我认为它在这里打破了

''2。创建命令对象,传入SQL字符串

Const selectString As String =" GetRules"

Dim cmd As SqlCommand

cmd = New SqlCommand(selectString,cn)

cmd.CommandType = CommandType.StoredProcedure


Dim reader As SqlDataReader = cmd.ExecuteReader()

>
请帮助我到处看看
Ok guys I have racked my brain on this one.

I have a vb .net service installed on a win2k server. I am trying to
get it to connect to sql 2000 box but I get this error:

An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)

I have remote connection turned on, on the sql2000. I have tried the
following connection strings

data source=<IP>;initial catalog=dfcdb;persist security info=False;user
id=user;password=PW;packet size=4096

data source=(local);initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=tcp:<IP>;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096

data source=<IP>:1433;initial catalog=dfcdb;persist security
info=False;user id=user;password=PW;packet size=4096 (that port is
open)

The service is set to run under my log on.

I made a windows app that tests connection strings and the first 3
work. I tested the service on a local machine with a local sql 2000 and
it works like a champ.

Here is the .net code to open the connection

''1. Create a connection
Dim SQLString As String = My.Settings.SQLConnectionString
Dim cn As New SqlConnection(SQLString)

cn.Open() <-- I think it breaks here
''2. Create the command object, passing in the SQL string
Const selectString As String = "GetRules"
Dim cmd As SqlCommand
cmd = New SqlCommand(selectString, cn)
cmd.CommandType = CommandType.StoredProcedure

Dim reader As SqlDataReader = cmd.ExecuteReader()

please help I have looked everywhere



这篇关于VB .net服务无法连接到sql 2000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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