Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
Cannot open database "mydb" requested by the login. The login failed.


my connection string is :

C#
public string connectionstring =
      @"Data Source=SSD-PC\SSD;Initial Catalog=mydb;user=sa;password=sa;Integrated Security=True";
Posted
Comments
Thanks7872 9-Sep-14 10:11am    
Ican't understand why you guys expect that some one will show you the direct and instant way to resolve the issue, you will implement it and done. Why? Have you ever heard about Google.com? Have you tried searching for the issue there?
MariwanIT 9-Sep-14 10:16am    
are you ok.
[no name] 9-Sep-14 11:16am    
@Rohan : hahaha,,, these people r really sick, u r right :(
[no name] 9-Sep-14 14:14pm    
u r a mother f******** tooo
E.F. Nijboer 9-Sep-14 10:12am    
try logging in using management studio and/or check out some of the examples here: http://msdn.microsoft.com/en-us/library/ms156450.aspx

Hi,

Change your Integrated Security value to false.

C#
public string connectionstring =
      @"Data Source=SSD-PC\SSD;Initial Catalog=mydb;user=sa;password=sa;Integrated Security=false";


Whilst Integrated Security is set to True, the connection will be attempted using the Windows based credentials - i.e. it will ignore the username/password values in the connection string.

Hope it helps.
 
Share this answer
 
Comments
MariwanIT 9-Sep-14 12:19pm    
dear How to solve this error:
this.tempTableAdapter.Fill Login failed for user 'sa'.
hypermellow 10-Sep-14 6:18am    
Hi, what happens when you connect using these credentials in SQL Server Management Studio?
If you can't connect using the Management Studio, then you'll need to review the permissions this user has in the target database.
MariwanIT 10-Sep-14 7:14am    
my programs countered 10000 bugs then i am creating a new one.
thanks for you help
if want to log in with windows authentication mode then you need to write Integrated Security=true instead of username and password
public string connectionstring =
@"Data Source=SSD-PC\SSD;Initial Catalog=mydb;Integrated Security=true";



if want to log in with SQL server authentication mode then you need to write user id and password instead of Integrated security= true other wise you can write Integrated Security=false

@"Data Source=SSD-PC\SSD;Initial Catalog=mydb;Integrated Security=false;user id=sa;password=sa;";

or

@"Data Source=SSD-PC\SSD;Initial Catalog=mydb;user id=sa;password=sa;";
 
Share this answer
 
delete Integrated Security or set it to false
 
Share this answer
 
Comments
[no name] 9-Sep-14 11:18am    
google google :D
try to make Integrated Security=false

C#
public string connectionstring =
     @"Data Source=SSD-PC\SSD;Initial Catalog=mydb;user=sa;password=sa;Integrated Security=false"
 
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