Solved

what am i doing wrong here?

Posted on 2006-11-03
3
213 Views
Last Modified: 2010-04-16
public int organization()
    {
        string con = "Data Source=sasql01;Initial Catalog=sandbox;Trusted_Connection=true;Persist Security Info=True;User ID=sa_sql;Password=str@teg1K@m3r1ka";
        SqlConnection conn = new SqlConnection(con);
        string fetch = "Select SMP_Media_Type_Desc from Scores";
        SqlCommand cmd = new SqlCommand(fetch, conn);
        SqlDataReader sdr = null;
        conn.Open();
        sdr = cmd.ExecuteReader();
        string organization = string.Empty;
        while (sdr.Read())
            organization = sdr[0].ToString();
        sdr.Close();
        conn.Close();

        return Convert.ToInt32(organization);
    }

I am not able to open up the connection. The error: Login failed. The user is not associated with the trusted connection.
0
Comment
Question by:siddhuoops
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 250 total points
ID: 17870842
Trusted_Connection=true; implies that the login is a windows user account so it is trying to login with the current windows user details rather than the User ID and password you are supplying.

Remove the Trusted_Connection=true; option and see what happens.
0
 

Author Comment

by:siddhuoops
ID: 17870869
That worked but as soon as I clicked on to go to the next page, the same problem interrupted the program.
0
 

Author Comment

by:siddhuoops
ID: 17870892
Part of the problem is with the rest of the program. At least I knew what was wrong with this code. Thank you very much.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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