Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Login failed for user ''. The user is not associated with a trusted SQL Server connection

Posted on 2009-05-03
5
Medium Priority
?
640 Views
Last Modified: 2012-05-06
Anyone.

Login failed for user ''. The user is not associated with a trusted SQL Server connection
-----------------------------------------------------------------------------------------------------------

This is the error that I am getting using a very simple program written in C#.

I am very new to both C# and SQL Server 2005 Express environment. This is a learning phase that I am going through. I read on the internet that I need to make the SQL serve have a Mixed Mode so that the Windows and SQL server authintactions both are applied.

I did that but the error remains. Also, I created a new user to start a fresh. That did not do well either. I am back on the drawing board and now I feel cornered and without knowledge.

Please help. I appreciate all of you in advance
Code:
            // Create a SQL adapter to Access/Update the values in the database
            SqlDataAdapter DBAdapter = new SqlDataAdapter("select * from User", SQLDb);
 
            // Create a Command Builder object to execute SQL             
            DBAdapter.SelectCommand = new SqlCommand("");
            SqlCommandBuilder DBCommBuilder = new SqlCommandBuilder(DBAdapter);
            DataSet DBDataSet = new DataSet();
 
            // Fill the dataset using the SQL Command specified within the Database Adapter 
            DBAdapter.Fill(DBDataSet, "User");
 
            // Reset the password to blank 
            DBDataSet.Tables["User"].Rows[1]["Password"] = "***";

Open in new window

0
Comment
Question by:ems180
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 24292642
the code posted is not the relevant code.
what you need to check is the part that set's up SQLdb, aka the connection string.

now, 2 questions:
* what does the connection string look like?
* is this for a windows forms application, or a web (iis) application?
0
 

Author Comment

by:ems180
ID: 24311249
The code is Windows Form. I tried to change the SQL Server auth. from Windows Authentication to Mixed mode and also changed the sa password in SQL server.

The connection string is as follows:
SqlConnection SQLDb = new SqlConnection(@"Data Source=MyComputer;" +
                                                @"Initial Catalog=MyDatabase" +
                                                @"Integrated Security=SSIP");

Even I tried Integration Security=True and also tried the user id and password combination.

I think that the problem is with SQL server settings. I have never administered the server myself and this is the first time that I am doing everything from scratch. I hope this will help
0
 

Author Comment

by:ems180
ID: 24311268
One thing i missed. I used the entity object using LINQ to the server with windows authentication to display the values and that works fine. When I try to update any value of use a DataAdapter to fill, I  get this error. The error comes up on the following line of code:

DBAdapter.Fill(DBDataSet, "User");
0
 

Author Comment

by:ems180
ID: 24311381
Never Mind. I think I resolved the problem. The issue was that the connection string was coded incorrectly. User Name and Password were not being supplied properly when using the sa login.

Thank You for your hint angelIII
0
 

Author Closing Comment

by:ems180
ID: 31577424
Thank You for your help. It gave me a hint to revisit the connection string and I found the problem. I can connect to the server and can see  the values. I will update the database as well.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question