PC Review


Reply
Thread Tools Rate Thread

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

 
 
dee
Guest
Posts: n/a
 
      14th Feb 2005
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


 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      14th Feb 2005
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" <dee@1> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
dee
Guest
Posts: n/a
 
      14th Feb 2005
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 [MVP C#]" <miha at rthand com> wrote in message
news:(E-Mail Removed)...
> 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" <dee@1> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Keenan Newton
Guest
Posts: n/a
 
      14th Feb 2005
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

 
Reply With Quote
 
dee
Guest
Posts: n/a
 
      14th Feb 2005
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

"Keenan Newton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      15th Feb 2005
"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.
__________________________________

"dee" <dee@1> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Keenan Newton
Guest
Posts: n/a
 
      15th Feb 2005
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.

 
Reply With Quote
 
Dana
Guest
Posts: n/a
 
      15th Feb 2005
thanks Bill
good to know

dee

"William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "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.
> __________________________________
>
> "dee" <dee@1> wrote in message
> news:%(E-Mail Removed)...
> > 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
> >

>
>



 
Reply With Quote
 
Angel Saenz-Badillos[MS]
Guest
Posts: n/a
 
      16th Feb 2005
> 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/




"dee" <dee@1> wrote in message news:(E-Mail Removed)...
> 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
>
> "Keenan Newton" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >

>
>



 
Reply With Quote
 
Dee
Guest
Posts: n/a
 
      21st Feb 2005
Thanks

"Angel Saenz-Badillos[MS]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> > 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/
>
>
>
>
> "dee" <dee@1> wrote in message

news:(E-Mail Removed)...
> > 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
> >
> > "Keenan Newton" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine AllenM Microsoft Outlook 0 11th May 2006 10:14 PM
Cannot connect to Exchange Server from a RDP, ICA session or from server local machine AllenM Microsoft Outlook Discussion 0 10th May 2006 05:51 PM
Local Service running in WinXP (What and why?) =?Utf-8?B?TWFyayBBLiBIdWNrYWJ5?= Windows XP General 1 10th Apr 2006 03:38 PM
How do i change this connect string to support a SQL Server 2000 running on port 8832 User ID=car;Password=rat;Server=abc.def.hij;Initial Catalog=foobar i tried Server=abc.def.hij:8823 and Server=abc.def.hij;port=8823 neither of these work Daniel Microsoft Dot NET Framework 1 16th Dec 2004 09:55 PM
WINXP in unable to connect to MS EXCHANGE 2000 Server forsaken Windows XP Networking 0 29th Jul 2003 04:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:01 AM.