Connecting to a named instance of SQL Server 2000

G

Guest

I've using Pocket PC 2002 and 2003 with SQL Server CE 2.0 installed

I'm trying using Visual Studio .NET 2003 and C# to connect to SQL Server 2000 SP3

Using the following lines of code I can connection to a default instance of SQL Server using the emulator and the PDA

System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection()
conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data Source=servername"
conn.Open()

Using the following ConnectionString I can connection to a named instance of SQL Server using the emulator, but NOT using the PDA

conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data Source=servername\instancename"

I've tried a Pocket PC 2002 and 2003 and both get the following error "Specified SQL server not found".

Any ideas or help?
 
A

Alex Feinman [MVP]

Try using server IP address instead:
Data Source=192.168.0.1\instancename

Philip Williams said:
I've using Pocket PC 2002 and 2003 with SQL Server CE 2.0 installed.

I'm trying using Visual Studio .NET 2003 and C# to connect to SQL Server 2000 SP3.

Using the following lines of code I can connection to a default instance
of SQL Server using the emulator and the PDA.
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data Source=servername";
conn.Open();

Using the following ConnectionString I can connection to a named instance
of SQL Server using the emulator, but NOT using the PDA.
conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data Source=servername\instancename";

I've tried a Pocket PC 2002 and 2003 and both get the following error
"Specified SQL server not found".
 
K

Kevin Boske - [MS]

How are your PocketPC devices connected to the network? Are you connecting
through an ActiveSync connection or do you have a network connection?


Kevin Boske
([email protected])
SQL Server CE Team
Microsoft
----------------------------------------------------------------------------
----------------------------------------
Everything you need to know about SQL Server CE:

http://www.microsoft.com/sql/ce/techinfo/default.asp
----------------------------------------------------------------------------
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
----------------------------------------------------------------------------
----------------------------------------
--------------------
Thread-Topic: Connecting to a named instance of SQL Server 2000
thread-index: AcPs04LI6NrZSD9mRI+Q4zElk4WXgw==
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
From: =?Utf-8?B?UGhpbGlwIFdpbGxpYW1z?= <[email protected]>
Subject: Connecting to a named instance of SQL Server 2000
Date: Fri, 6 Feb 2004 09:06:07 -0800
Lines: 17
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45135
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I've using Pocket PC 2002 and 2003 with SQL Server CE 2.0 installed.

I'm trying using Visual Studio .NET 2003 and C# to connect to SQL Server
2000 SP3.

Using the following lines of code I can connection to a default instance of
SQL Server using the emulator and the PDA.

System.Data.SqlClient.SqlConnection conn = new
System.Data.SqlClient.SqlConnection();
conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data
Source=servername";
conn.Open();

Using the following ConnectionString I can connection to a named instance
of SQL Server using the emulator, but NOT using the PDA.

conn.ConnectionString = @"User ID=sa;Initial Catalog=databasename;Data
Source=servername\instancename";

I've tried a Pocket PC 2002 and 2003 and both get the following error
"Specified SQL server not found".

Any ideas or help?
 
G

Guest

Already tried it. Works for the defalut instance (Data Source=192.168.0.1), but not for the named instance (Data Source=192.168.0.1\instancename). Still get "Specified SQL server not found".
 
K

Kevin Boske - [MS]

What port# is your second instance of SQL listening on? You may need to
specify it, if it is not 1433 (the default).

Kevin Boske
([email protected])
SQL Server CE Team
Microsoft
----------------------------------------------------------------------------
----------------------------------------
Everything you need to know about SQL Server CE:

http://www.microsoft.com/sql/ce/techinfo/default.asp
----------------------------------------------------------------------------
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
----------------------------------------------------------------------------
----------------------------------------
--------------------
Thread-Topic: Connecting to a named instance of SQL Server 2000
thread-index: AcPu9m1nCJrNWVRZS8C7NhbavhOe4g==
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
From: =?Utf-8?B?UGhpbGlwIFdpbGxpYW1z?= <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: Connecting to a named instance of SQL Server 2000
Date: Mon, 9 Feb 2004 02:21:06 -0800
Lines: 1
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:45279
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Already tried it. Works for the defalut instance (Data
Source=192.168.0.1), but not for the named instance (Data
Source=192.168.0.1\instancename). Still get "Specified SQL server not
found".
 
G

Guest

Thanks. I've added the port to the connection string and it works great

I've observed that when the port is specified, the data source value is ignored. So, "Data Source=servername\instancename,1433" connects to the default instance and "Data Source=servername,1121" connects to the named instance

Is this normal behaviour?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top