我在 asp.net 中开发一个应用程序,遇到了以下问题:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string connString = "Data Source = JOHN-4E29FADEE; database=PEOPLE;";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
Response.Write("Succes");
SqlCommand comanda = new SqlCommand();
comanda.Connection = conn;
comanda.CommandType = System.Data.CommandType.Text;
comanda.CommandText = "Select PERSON_ID,FIRST_NAME,FATHER_INITIALS, LAST_NAME, BIRTHDATE,CNP,MOTHER_CNP,FATHER_CNP from PERSON order by FIRST_NAME";
SqlDataReader dr = comanda.ExecuteReader();
GridView4.DataSource = dr;
GridView4.DataBind();
conn.Close();
}
catch (SqlException exc)
{
Response.Write("Connection Error! " + exc.Message);
}
}
当我启动应用程序时,我得到Connection Error! Login failed for user
.