Did you add a line to indeed update the textbox? See bold italic line below
//Get the count
Int32 count =(Int32) myCommand.ExecuteScalar();
//Set the TextBox valueTextBox1.Text = count.ToString();
That line is missing in Zhi Lv's reply.
I think that it's the intention to replace the line in the following with the presented code
protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e) {TextBox1.Text = e.AffectedRows.ToString();
// new code here }