Cant connect to local sql server 2000 from VB.NET running WinXP Pro SP2

  • Thread starter Thread starter dee
  • Start date Start date
D

dee

Hi

I just installed SQL Server 2000 to run locally on a WinXP Pro SP2 PC.
When I run the following VB.NET code:

Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Northwind;" & _
"Integrated Security=SSPI"

Dim connectionString As String = SQL_CONNECTION_STRING

Dim cnnNW As New SqlConnection(connectionString)

I can't connect to sql server.
This code works fine on a Windows 2000 Pro SP2 pc.

Thanks.

Dee
 
Hi Miha,

No its a windows Form application.
The application cant connect to sql server.
I am running the sample code from several of microsoft dotnet books
and none of them can connect to the server.

Thanks.


Miha Markic said:
Are you talking about an asp.net application?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

dee said:
Hi

I just installed SQL Server 2000 to run locally on a WinXP Pro SP2 PC.
When I run the following VB.NET code:

Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Northwind;" & _
"Integrated Security=SSPI"

Dim connectionString As String = SQL_CONNECTION_STRING

Dim cnnNW As New SqlConnection(connectionString)

I can't connect to sql server.
This code works fine on a Windows 2000 Pro SP2 pc.

Thanks.

Dee
 
Well have you tried getting to the Northwind database via Sql
Enterprise manager. If so attempt a query using sql query anaylser
once you prove those are fine. Try changing your connection string and
instead of pointing the server to localhost, use the actual machine
name.

SERVER=MyComputer
 
wow
thanks keenan it works ... big life saver

wonder why localhost worked on windows 2000 and not here
but actually i really care that i can connect

thaaaaaanks
dee
 
"localhost" is an IIS shortcut, not a SS shortcut. You can use "." or
"(local)" with SS to refer to the local default instance. These can also be
used with a specific instance name if preceded with "\" as in ".\Fred".

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
You know what Bill you are absolutely right, sad part is once you
mentioned it I have kicked myself in the butt over this same mistake in
the past.
 
thanks Bill
good to know

dee

William (Bill) Vaughn said:
"localhost" is an IIS shortcut, not a SS shortcut. You can use "." or
"(local)" with SS to refer to the local default instance. These can also be
used with a specific instance name if preceded with "\" as in ".\Fred".

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
wonder why localhost worked on windows 2000 and not here
There is a big problem with "localhost" it never connects using shared
memory (which is what you want to use when connecting to a local machine. It
only works with TCP and Named Pipes. If these protocols are not enabled
(which is probably what you are seeing here) it will not be able to connect.
In any case you loose a LOT of performance when connecting to a local server
with anything other than shared memory, just don't do it.

For RTM and Everett you should only use :<machine name>, "." and "(local)
when connecting to a local server, never "localhost". This problem is so
rampant that in the current beta1 of Whidbey we are forcing "localhost" to
use shared memory.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/
 
Thanks :)

Angel Saenz-Badillos said:
wonder why localhost worked on windows 2000 and not here
There is a big problem with "localhost" it never connects using shared
memory (which is what you want to use when connecting to a local machine. It
only works with TCP and Named Pipes. If these protocols are not enabled
(which is probably what you are seeing here) it will not be able to connect.
In any case you loose a LOT of performance when connecting to a local server
with anything other than shared memory, just don't do it.

For RTM and Everett you should only use :<machine name>, "." and "(local)
when connecting to a local server, never "localhost". This problem is so
rampant that in the current beta1 of Whidbey we are forcing "localhost" to
use shared memory.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




wow
thanks keenan it works ... big life saver

wonder why localhost worked on windows 2000 and not here
but actually i really care that i can connect

thaaaaaanks
dee
 
Back
Top