Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

what am i doing wrong here?

Posted on 2006-11-03
3
Medium Priority
?
217 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
[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
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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