November 15, 2011 at 3:23 pm
hi!
i have create a vizual c# program linq to sql ..when i whont to open the databse from vizual i have this error ...
Cannot open database requested by the login. The login failed. Login failed for user
please can someone help me ??
November 15, 2011 at 3:27 pm
Pretty sparse on details but we will see what we can do.
Can you connect to the database is SSMS with the same credentials you are using from your application? Double check username and password as a place to start.
Does the user have access to the database you are trying to connect to?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 15, 2011 at 3:34 pm
when I open the database from sql it not open to visual c# and vice versa
and when i do the add student on the program, the student is adde to the datagred..but not added on the database . i use windows authentication.
sometime seid that the database is used by other program π
November 15, 2011 at 3:37 pm
So you can only have 1 open connection at a time? Are you using Access?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 15, 2011 at 3:43 pm
Here is few troubleshooting I would do as starting pointβ¦
1)Make sure in the C# code connection string, you pointing to correct database and using the correct credential.
2) As Sean suggested go SSMS and try use the credentials you are trying to use, if it fails connect as admin and see if the user has credentials and mapped to the correct database
Hope it helps.
November 15, 2011 at 3:45 pm
i have to create a desktop program ,and im usin vizual c# 2010 and sql server 2008 both expres edition .
now i create the code and the connection ...bug the program doesen add the student on the database only on the datagrid
if i open the database first on sql server i cant open it on the vizual C # ..and the error is : Cannot open database requested by the login. The login failed. Login failed for user
but if i open the database first on vizua c i cant open then on the sql server ..and the error is : The database is not accessible (ObjectExplorer)
November 15, 2011 at 3:54 pm
Make sure SQL server is running, the database exists and is online β¦β¦.
Also in Visual studio when you added the data source connection did you run a test connection at the end of the wizard? If not try to re-create your connection through the IDE and test as well.
November 15, 2011 at 4:01 pm
at first time i run the program as administrator and the test connection go OK
but when i do the test now i got a error
can i send you the program and see it?? pls i really have to do this
November 16, 2011 at 4:41 am
alban_ml (11/15/2011)
at first time i run the program as administrator and the test connection go OKbut when i do the test now i got a error
can i send you the program and see it?? pls i really have to do this
I guess you are not saving these credentials in Connection String. Itβs just a logical error in your .Net Connection String. Focus only on it.
November 16, 2011 at 6:18 am
<connectionStrings>
<add name="Business.Properties.Settings.SchooldbConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Schooldb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
this is the connecion string...i dont know were is the proble π
November 16, 2011 at 6:29 am
alban_ml (11/16/2011)
<connectionStrings><add name="Business.Properties.Settings.SchooldbConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Schooldb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
this is the connecion string...i dont know were is the proble π
Connection strings for SQL Server 2005
March 5, 2013 at 5:42 am
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply