T

T

  • NA
  • 5
  • 0

Problem connecting to the database !!!

Jun 29 2006 6:10 AM
Hi,
I am new to .net. I'm developing a sample web application in ASP .net (using C#). I am trying to connect to the database & i keep getting this error. I'm trying to authenticate the username & password that the user enters with my backend table & print it on the page. But I keep getting -->

Login failed for user 'CRM\ASPNET'.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'CRM\ASPNET'.

My code is :
myConn = new SqlConnection("Initial Catalog=repository;Data Source=localhost;Integrated Security=SSPI;");
myCmd = myConn.CreateCommand();
myCmd.CommandText = "SELECT loginname, password FROM Employee where loginname = '"+TextBox1.Text +"' and password = '"+TextBox2.Text+"'";
myConn.Open();
myReader = myCmd.ExecuteReader();
while (myReader.Read())
{
results = results + myReader.GetString(0) + ", " + myReader.GetString(1) ;
}

Can anyone help me debug this problem. I cannot proceed further till i solve this...PLZ HELP!!!!


Answers (5)