Solved

what am i doing wrong here?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now