locked
Login Failed for user ' ' when opening connection with SQL Server RRS feed

  • Question

  • User-1699927070 posted
    protected void showUsers_Click(object sender, EventArgs e)
    {
      find = BulletedList1.Items.FindByText("352263").ToString();
      idBox.Text = find.ToString();
    }
    protected void showName_Click(object sender, EventArgs e)
    {
      using (SqlConnection conn = new SqlConnection("Data Source=sinkclient.com;Initial Catalog=MLM_Database;User 
      ID=mubarik;Password=***********"))
    {
      conn.Open();
      using (SqlCommand cmd = new SqlCommand("SELECT cust_Name FROM Customer_Info WHERE cust_ID = '352263'",conn))
      {
        using (SqlDataReader Reader = cmd.ExecuteReader())
        {
          NameBox.Text = Reader["cust_Name"].ToString();
        }
      }    
     }
    }

    A BulletedList is DataBound and it shows correct data from same database. While opening connection between SQL Server 2012 and ASP.Net WebForms application on ButtonClick event,  this exception occurs: Login Failed for user 'username'. The credentials provided in the connection string are also correct. Exception occurs at conn.Open();

    Saturday, August 12, 2017 8:39 AM

All replies