Solved

login failed

Posted on 2008-10-19
1
160 Views
Last Modified: 2010-04-15
please look at the code, what is wrong?
public partial class _Default : System.Web.UI.Page 

{

    SqlConnection conn = new SqlConnection("Data Source=ITNB;Initial Catalog=Events;User ID=haris, pwd=haris");

    SqlDataAdapter da = new SqlDataAdapter();

    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)

    {

        SqlCommand cmd = new SqlCommand("select * from eventstable",conn);

        cmd.CommandType = CommandType.Text;

        conn.Open();

        da.SelectCommand = cmd;

        da.Fill(ds);

        conn.Close();

    }

}

Open in new window

0
Comment
Question by:harisbscs2003
1 Comment
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 22751429
your connection string is wrong, you have a comma instead of semicolon between the userid and password:
SqlConnection conn = new SqlConnection("Data Source=ITNB;Initial Catalog=Events;User ID=haris; pwd=haris");

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

20 Experts available now in Live!

Get 1:1 Help Now