@HelpIT

В Textbox появляется System.Web.UI.WebControls.TextBox когда нажимаю на Update button. Как это можно исправить?

protected void btnUpdate_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings
                ["StudentConnectionString"].ConnectionString);
            conn.Open();
            string updateQuery = "update Students set firstName = '"+ txtBoxfName + "'," +
                " lastName = '"+ txtBoxlName +"', " +
                "studentNo = '" + Convert.ToInt32(txtBoxStudentNo.Text) +
                "' where id_student = '"+ Convert.ToInt32(txtPK.Text) +"'";
            SqlCommand cmd = new SqlCommand(updateQuery, conn);
            cmd.ExecuteNonQuery();
            Label2.Text = "student successfully updated";

            txtBoxfName.Text = " ";
            txtBoxlName.Text = " ";
            txtBoxStudentNo.Text = " ";

            conn.Close();

        }
  • Вопрос задан
  • 39 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы