please click on below link for sql helper Execute Reader Example.
How to close Sql connection in SQLHelper.ExecuteReader method
http://www.aspsnippets.com/Articles/Using-SqlHelper-class-in-ASPNet-Tutorial-with-examples-in-C-and-VBNet.aspx
Hi vinu@asp,
Refer the below code.
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; SqlConnection con = new SqlConnection(constr); string query = "SELECT TOP 5 CustomerId, Name, Country FROM Customers"; SqlDataReader sdr = SqlHelper.ExecuteReader(con, CommandType.Text, query); GridView2.DataSource = sdr; GridView2.DataBind(); con.Close();
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.