Solved

login failed

Posted on 2008-10-19
1
161 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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