Solved

what am i doing wrong here?

Posted on 2006-11-03
3
212 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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