Solved

login failed

Posted on 2008-10-19
1
164 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
[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
1 Comment
 
LVL 143

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

734 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