Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
it shows this error Login failed for user 'sa'.
in
this.tempTableAdapter.Fill(this.mydbDataSet.temp);

any one can help me?
Posted

1 solution

You either have the wrong password, or SQL Authentication is not enabled.

Your application shouldn't be connecting as sa anyway. You should always use a specific account which has only the privileges required by your application.
 
Share this answer
 
Comments
MariwanIT 9-Sep-14 13:42pm    
dear Richard I have tested connection to sa is works fine but when i add binding source to datagridview it shows me that error. also, I have created another sql server user also it shows me login faild for sa user!!! which is strange I have googled many time but still no answer
Richard Deeming 9-Sep-14 13:44pm    
The error message is very clear: you are not using the correct password for the sa account.

If you've tested the connection and it works, then you're not testing the same thing. The password you're using in your application is wrong.
Thomas Nielsen - getCore 12-Sep-14 4:01am    
An alternative reason is that the rights of the sa account doesn't extend properly to the object you're trying to get. Of cause SA shouldn't be used by an application because it is from origin unrestricted. If it doesn't have rights, another user than sa has dbo permissions perhaps and that's really weird in a number of ways but it's possible. check the rights and do make a login intended for that purpose as it will show nicely everywhere. You'll like yourself for it later :)
MariwanIT 12-Sep-14 4:33am    
thanks dear Thomas ,
how can hide password from appconfig in c#??
because i will save application password in my db account and i don't want someone access it through appconfig
Thomas Nielsen - getCore 12-Sep-14 4:43am    
you cannot really. One option is to write in in a code behind global file, then people have to disassembly your code to read it.
Or you'll have to encrypt/ decrypt when writing the the connectionstrings element
http://msdn.microsoft.com/en-us/library/system.security.cryptography.aes(v=vs.110).aspx

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