Click here to Skip to main content
13,148,573 members (63,609 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I am getting one error while login.

Like -

"A network-related or instance -specific error occurred while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and sql server is configured to allow remote connections.(provider:Named pipes Provider,error:40 Could not open a connection to sql server)"
and in my web.config file
<add key="dbConnection" value="Data Source=Shrinidhi-PC;Initial Catalog=SeatAllotment;Integrated Security=true;" />
and one more thing in my sql there is not login.i mean to say there is no login user name and password it connects it correct??

Can anyone suggest me what type of error?

Posted 14-Mar-12 1:36am
Updated 14-Mar-12 1:40am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Check your SQL connection values..
ythisbug 14-Mar-12 7:42am
hi anuj in sql login btn click??i used class there i have to change??
Anuj Banka 14-Mar-12 7:48am
First use Sql server management studio and use the credencials that you have given in web cinfig to login.i mean check are you able to connect with server from Sql server management studio
ythisbug 14-Mar-12 7:54am
in my web config file
add key="dbConnection" value="Data Source=SHRINIDHI-PC;Initial Catalog=SeatAllotment;Integrated Security=true;">
is it correct?
Anuj Banka 14-Mar-12 8:05am
add name="cn3" connectionstring="Data Source=ION-202\SQLEXPRESS;Initial Catalog=IonIntranet_dev;Integrated Security=True"

Use connection string and what is your button code ?
ythisbug 14-Mar-12 7:52am
i dint give credential.its connect properly to sql
Anuj Banka 14-Mar-12 7:55am
See the proble, is you are unable to connect with SQL either you using wrong username or password or wrong server name..

Then please post the code which you are using to connect with database.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Check your connection string. try browsing the database from visual studio and if you can then just take the connection string from the database properties window and use that connection string.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

In your connection string do the Trusted_Connection=true
ythisbug 14-Mar-12 7:51am
thanks but still same error
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Check once that your sqlserver is started
To start the service follow the steps bellow
Control Panel-->Administrator Tools-->Services--->(Select)Sql Server[Your server whic you use to connect] --on Left top click on Start

If the Sqlserver has the Sql Server Authentication Always use trusted connection with the related username/password
hope this will help..

You can have a better idea about the connection string just follow my blog post here
Connection string properties
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

thank you all guys.actually error was in my system.
then i changed Souce name
add key="dbConnection" value="Data Source=SHRINIDHI-PC/SQLEXPRESS;Initial Catalog=SeatAllotment;Integrated Security=true;">
Rate this: bad
Please Sign up or sign in to vote.

Solution 6

Please check the coonnection
object(connection staring is not proper for this error)

Please Check


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 17 Mar 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100