ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Delete and display record from database in ASP.Net GridView using C#<p>Hi <a class="username" rel="itsme"> itsme</a>,</p> <p>For deleting record ExecuteNonQuery method use.</p> <p>After deleting the record you have to bind the gridview.</p> <p>Check the updated code.</p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { checkExpired(); FillGrid(); } } void checkExpired() { string constr = ConfigurationManager.ConnectionStrings[&#34;Q_SS_regnConnectionString1&#34;].ConnectionString; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(&#34;delete from JS_Resume where email=&#39;&#34; + Session[&#34;mail&#34;].ToString() + &#34;&#39; and CONVERT(DATE, Last_Apply_date) = CONVERT(DATE, CURRENT_TIMESTAMP) and Status=&#39;Rejected&#39;&#34;, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } void FillGrid() { string constr = ConfigurationManager.ConnectionStrings[&#34;Q_SS_regnConnectionString1&#34;].ConnectionString; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(&#34;select * from JS_Resume where email=&#39;&#34; + Session[&#34;mail&#34;].ToString() + &#34;&#39;&#34;, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); GridView2.DataSource = dt; GridView2.DataBind(); }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/209590/Delete-and-display-record-from-database-in-ASPNet-GridView-using-C/https://www.aspforums.net:443/Threads/209590/Delete-and-display-record-from-database-in-ASPNet-GridView-using-C/Tue, 20 Aug 2019 03:40:02 GMT