protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = BaseClass.DBCon(); conn.Open(); int score = Convert.ToInt32(TextBox1.Text); int id = Convert.ToInt32(GridView1.SelectedValue); Homework homework = new Homework(); homework.Add2(id, score); TextBox1.Text = ""; }