protected void Button2_Click(object sender, EventArgs e) { string nam = name.Text; long contact1 = Convert.ToInt64(contact.Text); string city1 = ddl2.SelectedItem.Text; Student s = new Student(nam, contact1, city1); DBOperations dbobj = new DBOperations(); int studentid = dbobj.AddStudent(s); if (studentid > 0) { Response.Write("<script>alert('Added Successfully with the ID" + studentid + "')</script>"); } else { Response.Write("<script>alert('Error')</script>"); } }