Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / August 2007

Tip: Looking for answers? Try searching our database.

SQL Server Connection Problem with C# Web Site...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
samadams_2006@yahoo.ca - 31 Aug 2007 22:12 GMT
Hello,

I have a problem that I'm hoping someone will be able to help me
resolve.

1)  I have a C# Web Site in which I connect to the database:  "Install
Microsoft SQL Server 2005 Express Edition" via the link on:

http://msdn2.microsoft.com/en-us/express/bb410792.aspx

This Web Site has various versions, but I use the following version:

-----------------------------------------------------------------------------------------------------------------------------------------------------
Install Microsoft SQL Server 2005 Express Edition
Microsoft SQL Server 2005 Express Edition is the free, easy-to-use,
lightweight version of SQL Server 2005. Integrated with Microsoft
Visual Studio 2005, SQL Server Express makes it easy to develop data-
driven applications that are rich in capability, offer enhanced
storage security, and are fast to deploy. SQL Server Express is free
to redistribute and can be seamlessly upgraded to more sophisticated
versions of SQL Server.

Download * (36.5 MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------

2)  I connect to this SQL Server version via the "Server Explorer" Tab
inside Visual Studio 2005.

Here's the connection string I am using:

Data Source=.\SQLEXPRESS;AttachDbFilename=E:\MyDB.mdf;User ID=sa

3)  When I click on the "Test Connection" command button, it states:

"Test Connection Succeeded".

4)  In spite of all this, when I run the application, I get an error
on the "End Try" of a "Try Catch" in my code.  This error states:

"SQL Exception was unhandled by user code.  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".

5)  Question:  Does anyone have any idea how to resolve this error.
The "Test Connection" said that it was fine, but it appears not to
be.  If it is indeed a problem with "under the default settings SQL
Server does not allow remote connections", I've looked, but how do you
change these settings?

Any ideas on how to proceed would be helpful.

Thanks
Sam
Ekrem Önsoy - 31 Aug 2007 21:35 GMT
Hello Sam!

How about changing your Connection string to:

Data Source=<computer_name>\SQLEXPRESS; Initial Catalog=<database_name>;
uid=sa; pwd=<password>

Signature

Ekrem Önsoy

> Hello,
>
[quoted text clipped - 50 lines]
> Thanks
> Sam
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.