473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Db connect problem

I'm fairly new to c#, but not new to programming. I'm tasked with rewriting
our Gupta/Sqlwindows apps (5 years worth of development) in dot Net. The
main reason is that virtually no one knows the language, which is
unfortunate because it's very simple to get windows created and rolled out.

I downloaded C# (orcas) express and had created a SqlServer 2005 database
(locally, ie not on a server) and moved some of our production data into it
just to see if I could start coding some of the "simpler" tables. I'm not
planning on using express in the long run, I'm just evaluating the software
at this point.

I can't connect to the database. When I go to Database Explorer and clik on
Data Connections, I fill in the dialog with the .mdf that I want to attach
to. It comes back with
"...When connection 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: SQL Network Interfaces, error: 26- Error Locating
Server/Instance Specified)"

I've checked to see that remote connections are specified and that I have
the correct protocols enabled. I can attach and query the tables in SQL
Server Management Studio 2005 just fine.

What, perhaps, am I doing wrong?
Sep 5 '07 #1
9 2550
Hi,

"Peter Lux" <pe******@theheritagegrp.comwrote in message
news:en**************@TK2MSFTNGP05.phx.gbl...
I downloaded C# (orcas) express and had created a SqlServer 2005 database
(locally, ie not on a server)
You will be better off with the 2005 version of the IDE , Orcas is still in
beta.
and moved some of our production data into it just to see if I could start
coding some of the "simpler" tables. I'm not planning on using express in
the long run, I'm just evaluating the software at this point.

I can't connect to the database. When I go to Database Explorer and clik
on Data Connections, I fill in the dialog with the .mdf that I want to
attach to. It comes back with
"...When connection 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: SQL Network Interfaces, error: 26- Error Locating
Server/Instance Specified)"
You do not connect to a particular mdf. you connect to the server, you enter
the server location, username/password and then you will see a list of the
databases in that server.

Sep 5 '07 #2
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message
You do not connect to a particular mdf. you connect to the server, you
enter the server location, username/password and then you will see a list
of the databases in that server.
The dialog that I get asks for a "Database file name (new or existing)" and
the browse button specifically looks for an .mdf.
You will be better off with the 2005 version of the IDE , Orcas is still
in beta.
I have a version of c# 2005 express (in addition to the "Orcas") and still
get that error 26 message.

Should I have to uninstall "Orcas"?
Sep 5 '07 #3
Hello Peter,
Thanks for Ignacio's reply.

Based on my experience, it seems like SQL Server Configuration issue.
Would you please check if SQL Browser service and SQL Server (SQLEXPRESS)
service are running on your server?

Start|All Programes|Microsoft SQL Server 2005|Configuration Tools| SQL
Server Configuration Manager.
Select "SQL Server 2005 Services" node in the left panel.
Start SQL Server Browser
Start SQL Server (SQLEXPRESS)

C# 2005 express always attaches the mdf file by SQLExpress service on local
machine.

Please try the above method and let me know if this method works on your
side. I will follow up. It's my pleasure to assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 6 '07 #4
Thanks for responding, this is sooo confusing.

I think I should tell you what my local config is. I've got SqlServer 2005 running on my machine because I attach to our Great Plains SqlServer that is also 2005. I don't believe I have Sql Server EXPRESS installed. It shouldn't make a difference even if I try to attach from c# 2005 (not the "Orcas" edition)

In the configuration, I have 5 services running (start mode is Automatic):

SQL Server Integration Services

SQL Server FullText Search (MSSQLSERVER)

SQL Server (MSSQLSERVER)

SQL Server Browser

SQL Server Agent (MSSQLSERVER)
In the protocols section, the only one that ISN'T enabled is VIA.

Please, let me know what I'm missing.

"WenYuan Wang [MSFT]" <v-******@online.microsoft.comwrote in message news:AA**************@TK2MSFTNGHUB02.phx.gbl...
Hello Peter,
Thanks for Ignacio's reply.

Based on my experience, it seems like SQL Server Configuration issue.
Would you please check if SQL Browser service and SQL Server (SQLEXPRESS)
service are running on your server?

Start|All Programes|Microsoft SQL Server 2005|Configuration Tools| SQL
Server Configuration Manager.
Select "SQL Server 2005 Services" node in the left panel.
Start SQL Server Browser
Start SQL Server (SQLEXPRESS)

C# 2005 express always attaches the mdf file by SQLExpress service on local
machine.

Please try the above method and let me know if this method works on your
side. I will follow up. It's my pleasure to assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Sep 6 '07 #5
Hi Peter

What OS are running on?

If you are using Vista, have you tried running Orcas as an administrator?
You cannot attach a new MDF file to a SQL Server 2005 database, unless you
are running as an admin.

--
Ged Moretta
Senior Software Engineer
AppSense Ltd
www.appsense.com

-----------------------------------------------------------------------
This signature isn't automatic. I have to type it manually every time.
"Peter Lux" <pe******@theheritagegrp.comwrote in message
news:u%****************@TK2MSFTNGP06.phx.gbl...
Thanks for responding, this is sooo confusing.
I think I should tell you what my local config is. I've got SqlServer 2005
running on my machine because I attach to our Great Plains SqlServer that is
also 2005. I don't believe I have Sql Server EXPRESS installed. It shouldn't
make a difference even if I try to attach from c# 2005 (not the "Orcas"
edition)
In the configuration, I have 5 services running (start mode is Automatic):
SQL Server Integration Services
SQL Server FullText Search (MSSQLSERVER)
SQL Server (MSSQLSERVER)
SQL Server Browser
SQL Server Agent (MSSQLSERVER)

In the protocols section, the only one that ISN'T enabled is VIA.
Please, let me know what I'm missing.
"WenYuan Wang [MSFT]" <v-******@online.microsoft.comwrote in message
news:AA**************@TK2MSFTNGHUB02.phx.gbl...
Hello Peter,
Thanks for Ignacio's reply.

Based on my experience, it seems like SQL Server Configuration issue.
Would you please check if SQL Browser service and SQL Server (SQLEXPRESS)
service are running on your server?

Start|All Programes|Microsoft SQL Server 2005|Configuration Tools| SQL
Server Configuration Manager.
Select "SQL Server 2005 Services" node in the left panel.
Start SQL Server Browser
Start SQL Server (SQLEXPRESS)

C# 2005 express always attaches the mdf file by SQLExpress service on
local
machine.

Please try the above method and let me know if this method works on your
side. I will follow up. It's my pleasure to assist you.
Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
Sep 6 '07 #6

<Gedwrote in message news:eB**************@TK2MSFTNGP03.phx.gbl...
Hi Peter

What OS are running on?

Windows XP Pro svp 2.
I know at one time, I attached to SqlServer 2000 (or 2003) from VB.net 2003
on my local machine.
Is there, maybe, I firewall setting or something like that I'm missing? I am
the local admin on my machine and like I said, I have all the processes up
and running. I can connect AND query thru Management studio.
Sep 6 '07 #7
Hello Peter,

According to your desption, you are using Visual C# 2008 express and SQL
server 2005.(SQL Server 2005 and C# 2008 express are installed on the same
mathine). You managed to attach to .mdf file in C# 2008 express Databaes
Explorer. But, Database explorer thowed error message "error: 26 - Error
Locating Server/Instance Specified" Please correct me if I misunderstood
anything.

Regarding to the error: 26 - Error Locating Server/Instance Specified, you
may check the following article.
http://blogs.msdn.com/sql_protocols/...work-interface
s-error-26-error-locating-server-instance-specified.aspx
[SQL Network Interfaces, error: 26 - Error Locating Server/Instance
Specified]

1) Make sure your server name is correct,
2) Make sure your instance name is correct and there is actually such an
instance on your target machine.
3) Make sure the server machine is reachable, e.g, DNS can be resolve
correctly, you are able to ping the server (not always true).
4) Make sure SQL Browser service is running on the server.
5) If firewall is enabled on the server, you need to put sqlbrowser.exe
and/or UDP port 1434 into exception.

If the above method doesn't resolve you issue, would you please paste the
connection string which VS 2008 Express generated? I suspect VS 2008
express connected to the SQL Server 2005 instance with wrong connect string.

In "Add Connection" dialog, click "Advanced..." button. Connect String
textbox is at the bottom of "Advanced Properties" dialog.

Please let me know if there is anything unclear. Have a great day!
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 7 '07 #8

"WenYuan Wang [MSFT]" <v-******@online.microsoft.comwrote in message >
If the above method doesn't resolve you issue, would you please paste the
connection string which VS 2008 Express generated? I suspect VS 2008
express connected to the SQL Server 2005 instance with wrong connect
string.
WenYuan -
Thanks for answering, and basically, no it's still not fixed. I also had a
problem (that's now resolved) with using SQL Server Business Intelligence
Development Studio. I uninstalled c# 2008 Express ("orcas") and next time I
tried to bring up my import project, it came back with a class not
registered. Spent the rest of the day trying to figure that out.

I've looked at the connections and the firewall, but what I'm not completely
clear on is if c# 2005 Exress can "talk to" Sql Server 2005 or if it HAS to
be Sql Server Express. I mentioned that I had changed the DefaultSSEName in
the registry to 'ITPETELXP' from 'SQLEXPRESS' (which I don't have running
anymore).
I still received the error. (ITPETELXP is the name of my machine, by the
way) When I go into either SSMS or into Configuration Manager, all the
servers are running but they say MSSQLSERVER (not ITPETELXP). When I change
the Data Source in the "Advanced" button off the Data Connection dialog to
".\MSSQLSERVER" the error changes to "Error 25 - Connection string is not
valid". It still gives me the same drivel about not allowing remote
connections, though.

The initial connect string is :

Data
Source=.\ITPETELXP;AttachDbFilename=C:\MSSQL$VSdot NET\Data\heritage.mdf;User
ID=sa;Connect Timeout=30;User Instance=True
Sep 11 '07 #9
Hello Peter
Thanks for your reply.

I checked the connect string:
Data Source=.\ITPETELXP;

Because you did not install SQL express edition on the machine, we cannot
define Data Source as ".\ITPETELXP". (It should be "." (which means the
default instance))

But, the 'Add New Connection' dialog box doesn't give that option. It is a
dropdown combo box. It can't be edited. That is a limitation of "Microsoft
SQL Server Database File" data source. In VS 2005 professional edition, we
can work around this issue by "Microsoft SQL Server" data source.

Now, would you please do the following steps to test again?

At first, we have to change the SQL Instance which VS express connects to
from ".\ITPETELXP" to ".".
1)Please click Tools | option | Database Tools | Data Connections
2)Remove the string "ITPETELXP" from "SQL Server Instance Name" textbox in
the right panel. (Leave it bank)

The, please add a new connection again.
This time, if you check the connect string, it should be
"Source=.;AttachDbFilename=C:\MSSQL$VSdotNET\Data\ heritage.mdf;User
ID=sa;Connect Timeout=30;User Instance=True"

* If you received an error message "The user instance login flag is not
supported on this version of SQL Server. The connection will be closed",
please click "Advanced" button and set "User Instance" property to false.

Please try the above method. I think that way should resolve the issue.
If the issue still persists, please let me know the connect string and the
exact error message. I'll follow up. We are glad to assist you.

Hope this helps.
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jordy | last post by:
Environment: Sun servers running solaris 2.8 Php 4.3.6 Apache 1.3.29 Mysql 4.1.1 phpMyAdmin 2.6.0-alpha1 phpAds 2.0 PhpMyadmin and phpAds don't succeed to connect the MySql database when
33
by: Savas Ates | last post by:
in asp page im getting this error how can i solve it.. yesterday the codes work but i setup visual studio 6.0 now it doesnt works..
4
by: Ellen K. | last post by:
Hi all, Being that so far I didn't get an answer to my below problem on the Oracle newsgroup, I figured it couldn't hurt to try here. While at my current job I've been working with mostly SQL...
3
by: Scott | last post by:
I am using DB2 Connect on HP-UX 11i to read data from an AS400 using SQL. DB2 Connect is converting a vertical bar (¦) character to this: ª. Please see the example below. I have tried changing the...
0
by: christopher keller | last post by:
Hello, Using MS Access 97, SR2 mit MDAC 2.7 / 2.8 English/Deutsch we get the old problem of 'object not found' in DB2 Connect Version 8. ( From MS KB Q129814: "When you try to attach a DB2...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
7
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
4
by: d3vkit | last post by:
Okay so I am at a loss here. I have a website that I've previously had no trouble connecting to the mysql DB on. I have an include to a connect file with the relevant connection info, and it was...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.