Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,
 
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

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 automatically..is it correct??
 
Can anyone suggest me what type of error?
 
Thanks
Posted 14-Mar-12 2:36am
ythisbug2.1K
Edited 14-Mar-12 2:40am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check your SQL connection values..
  Permalink  
Comments
ythisbug at 14-Mar-12 7:42am
   
hi anuj in sql login btn click??i used class there i have to change??
Anuj Banka at 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 at 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 at 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 at 14-Mar-12 7:52am
   
i dint give credential.its connect properly to sql
Anuj Banka at 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
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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

Solution 4

Hi,
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
  Permalink  
v2
Rate this: bad
good
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;">
  Permalink  
Rate this: bad
good
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
 
Regards
Deepak,
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 CPallini 155
3 PIEBALDconsult 150
4 BillWoodruff 148
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 17 Mar 2012
Copyright © CodeProject, 1999-2014
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