protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text != null) { int AdID = Convert.ToInt32(TextBox1.Text); using (var context2 = new AdDatabaseModel.AdDatabaseEntities()) { context2.PendNewAd(AdID); } } }