.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Connect to existing sql 2005 database

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

Hello There,

I had successfully restored sql 2000 database to sql 2005. It works like charm

Now i am creating a database model in MVC

I follow these steps

Right click on model > ADO.NET entity data model > Generate from database > New connection (Microsoft sql server) > server name > select or enter database name

But no server name AND database name show in both drop down lists. When i mannually enter database name (which exists in sql 2005) then click on TEST CONNECTION. It gives follwoing error

"A network-related or instance-specific error while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections.

Kindly help me with this


View Complete Post

More Related Resource Links

how to connect my hosting database from my pc using sql server management studio 2005



I have one asp.net hosting account with some service provider.. 

They have given me some xxx.xxxxxx.com to access sql server from my desktop... 

I enter xxx.xxxxx.com in server name and username and password but it will not connect.. 

so please let me know what are the steps i have to do to access my hosting database...

they have given sql server 2008 im using in local sql server 2005 management studio so let me know how to connect

thanks in advance

Cannot connect to Sql server 2005 database engine

Hello everybody!

I am having problems to connect to Sql Server Database Engine. I have recently(yesterday) installed Sql Server 2005 Developer Edition. The installation was totally successfull. Yesterday I was able to connect to Sql Server Database engine via SSMS but today it gives me an error:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476

It is strange because only one day before It worked fine.

Thanks a lot

Adding an SP 2010 server to an existing farm. "Failed to connect to the configuration database." dur


I have an existing sp 2010 enterprise server hosting websites and central administration.  I have a seperate sql 2008 r2 server holding the databases.  My goal is to setup another sp 2010 enterprise server to provide redundancy for the websites and central admin.  I believe I am able to accomplish this by adding another web front end to the farm.  On the second server, I install sp 2010, run the config wizard and connect to the config database located on the sql server, however, I am interrupted at step 3 when I am notified of the following:

Failed to connect to the configuration database.
An exception of type System.InvalidOperationException was thrown.  Additional exception information: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
System.InvalidOperationException: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
   at Microsoft.SharePoint.Administration.SPEncryptedString.CheckCredentialLock()
   at Microsoft.SharePoint.Administration.SPManagedAccount.Deploy(SPApplicat

Error 26 while trying to Connect to a SQLExpress 2005 database on a remote computer


I have installed SQL Express 2005 on two computers networked and running windows XP.  I've copied the database from the first computer to the second and run queries on both to show that both computers have an active database that is up and running.  Now I am trying to use the Sql Server Management Studio Express (SSMSE) on the first machine to establish contact with the second machine.  In order to have the two machines communicate I've configured the SQL Server on the second machine as follows:

Under the protocols for the SQL Server 2005 Network Configuration I've enabled the TCP/IP pipes and set the TCP/Dynamic ports to 1032 (when I ran netstat -a it indicated that this was an active connection which I think this means it is available - though it says that the port has a Foreign Address and it State is listening).  As an aside the port 1433 was not among the active connections.

Both the SQLServer and the SQLServer browser are running (which presumably means they are both enabled).

I've run the surface Area Configuration For Services and Connections Tool to Set the SQLExpress Remote connections for Local and remote connections using TCP/IP and named pipes.

The Client Protocols for the SQL Native Client Configuration is stillset so that the default port is 1433. 

When I look at the most recent

Report Designer Unable to Connect to SQL 2005 Database...Sort of.


SO here is the problem I have a whole project SSRS 2005 project that is unable to connect to the SQL 2005 Standard database. When I try to access the data under the "Data" tab I get the following Error.  Interestingly when I go in the data source connection settings and click the "Test Connection" all is good. But still the report is not able to pull any data without the error comming up. I have removed and reinstalled VS 2005 Pro, removed and reinstalled SQL tools on the workstation all with the same error. I have the same project on an older laptop and all is well. Help!!!!



TITLE: Microsoft Report Designer

A connection cannot be made to the database.
Set and test the connection string.


Format of the initialization string does not conform to specification starting at index 75. (System.Data)

More on the Error:



A connection cannot be made to the database.
Set and test the connection string.
 (Microsoft Report Designer)

Program Location:

   at Microsoft.ReportDesigner.Design.Query.CreateConnection()

could somebody give me example how I can connect to database only once if I use many models in contr


I use in my ASP.NET MVC application repository pattern and I use in controller for example 3 models:

   namespace MvcApplication1.Controllers  
        public class HomepageController : Controller  
            private IWebsitesRepository _repository_websites = new WebsitesRepository();  
            private IFirmRepository _repository_firm = new FirmRepository();  
            private IPhotosRepository _repository_photos = new PhotosRepository();  

In WebsiteRepozitory, FirmRepository and PhotosRepository classes I have:

Database1Entities _entities = new Database1Entities();

So I have 3 connections to database ? Is it wrong ? How can I solve it ?

Data Joins The Team: Introducing Visual Studio 2005 Team Edition for Database Professionals


Here Brian Randell presents everything you need to know to get started with Visual Studio 2005 Team Edition for Database Professionals.

Brian A. Randell

MSDN Magazine February 2007

unable to connect to database



I am using visual studio 2005 and sql server 2005.

I am developing a small quiz application and i have stored the connection string in app.config file which is given below.:

<?xml version="1.0" encoding="utf-8" ?>
        <add name="quizdb"
            connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Quiz Application.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            providerName="System.Data.SqlClient" />
i have retrieved connection string property through configurationmanager class 

and when i m connecting to database  it gives me a runtime error:


Sql Exception was unhandled

System.Data.SqlClient.SqlException was unhandled
  Message="An attempt to attach an auto-named database for file F:\\Quiz\\Quiz\\bin\\Debug\\Quiz Application.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located

Cannot connect to the configuration database.



when i open my central administation i get this error:

Cannot connect to the configuration database


plz help?

cannot connect to the configuration database


Hi All,

Recently I have migrated my SharePoint BackEnd (Database) Server to new hard drive. The reason of migration was to deploy and configure real time database replication by Symantec Veritas. After migration activity I was getting following error message

" cannot connect to the configuration database ".

But when I execute following steps, this errors message gone and everything got fine

1. Enable Named Pipe from SQL Server Configuration Manager > Protocols for MSSQLSERVER

2. Restart  SQL Server (MSSQLSERVER) service (Note: This service was already running and status was set to automatic ) and

3. Start SharePoint Configuration Wizard  

Now I need to know why every time I have to restart this service? When I turned on my sharepoint server machines in the moring I have to restart this service ( SQL Server (MSSQLSERVER) otherwise same error message appears (cannot connect to the configuration database). After restarting this service everything gets normal.

Any help in this regard will be greatly appreciated.


SQL 2005 Database Problem

When trying open up a report from a customer database.  I recieved the following error: Please contact technical support with the following information:   Error ID: ERHIG030000340 Error message: There was a problem with the SQL or table when trying to open the display The table name is "taOrderHistory" The SQL is: Underlying problem: Column 'taOrderHistory.OrderHistoryID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at RadWebNet.rwDataSupport.OpenData(String SQLIn, rwConnection ConnIn, OpenDSReturnType ReturnWhat, Int32 TimeOut, Object[] ParamsIn) in D:\Misc Projects\RadWeb\RadwebV4-7-1\rwData.v

Failure in restoring an database from tape - SQL Server 2005

Hello everyone, we are trying to restore one of our datebase from tape using the T-Sql commands. Using the GUI results in an timeout. The command we are using to start the restore is: RESTORE DATABASE RECOV FROM Tape = '\\.\tape0' WITH  FILE=2, RECOVERY, NOUNLOAD, STATS=5, MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\data\RECOV.mdf', MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\log\RECOV_log.ldf', REPLACE the restore proces start without any problem, only ending with this: Processed 2598808 pages for database 'xxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Data' on file 2. Processed 3 pages for database 'xxxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Log' on file 2. Msg 3229, Level 16, State 2, Line 1 Request for device '\\.\tape1' timed out. Msg 3213, Level 16, State 1, Line 1 Unable to unload one or more tapes. See the error log for details. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally. In the eventlog, the following is recorded: BackupTapeFile::UnloadTape: PrepareTape(UNLOCK) failure on backup device '\\.\tape0'. Operating system error 21(The device is not ready.). For as far we can judge, the tapedrive is functioning without problems. Using the same tape in an other tapedrive on an different server results in the same error. Hardware used: HP Proliant Server (DL580) with additional SCSI interface card HP StorageWorks LTO 4 tapedriv

Unable to install SP3 on SQL 2005 due to Database Services language being blank

Hi all,   I have an issue that requires me to upgrade to a later SP (currently on RTM), but when I try to install SP3 Database Services cannot be ticked. Upon inspection I see that its reporting "This update requires language ENU.  The language for this product instance MSSQLSERVER is . Download the upadte for langage .", when I check teh Language field to the right it is blank, other parts however are fine and can be upgraded. Can you advise please as I don't know how to manually set the language (which is reported inside SQL itself as English (United Kingdom)) and I cannot un/reinstall. Thanks, John

My Sql server 2005 Database in recovery mode for 3 -4 hours every day

Hi , Some of our Sql Server 2005 databases remain in recovery mode after midnight for almost 3 to 4 hours. So when my application access them error "Databse in recovery" and for same database this happens again and again every night. Please suggest why and how this can be solved?

Cannot connect Visio 2007 to SQL Server CE 3.5 database?

I am trying to reverse engineer a database (running under SQL Server CE 3.5 SP1) with Visio 2007 Professional.  I may be being blind, but I can find not way for Visio to do this.  Am I missing something or just piddling into the wind? Fully patched Vista. Thanks, Ed Bessant  

Can't connect to SQL 2005 Enterprise using Management Studio with Server Name (only (local) works

This is a test system, everything running locally & no domains. Win 2003 Ent. Server & SQL Server 2005 Enterprise. I can't log into SQL Server Management Studio using the server name & using either Windows Authentication or SQL login. If I change the name of the server in the drop-down list to "(local)", I connect just fine (both Windows & SQL security modes). Shared Memory, Named Pipes & TCP/IP enabled in both server & client. Remote connections allowed. I have IP adresses (both & external IP) in my hosts file pointing to the server name. Does SQL require a DNS server? This wouldn't be a problem except for the fact that I can't install SQL 2005 SP3 due to authentication failure since there's no way to enter (local) as the server name. SQL tools (management studio, SP install) seem to see the SQL server running but won't authenticate the user through any means other than setting server name to (local). This is driving me crazy!!!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend