Click here to Skip to main content
15,745,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?

Updated 14-Mar-12 1:40am

Check your SQL connection values..
Share this answer
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
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.
Share this answer
In your connection string do the Trusted_Connection=true
Share this answer
ythisbug 14-Mar-12 7:51am    
thanks but still same error
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
Share this answer
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;">
Share this answer
Please check the coonnection
object(connection staring is not proper for this error)

Please Check

Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900