{string connStr = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;SqlConnection mySQLconnection = new SqlConnection(connStr);if (mySQLconnection.State == ConnectionState.Closed){ mySQLconnection.Open();}SqlCommand mySqlCommand = new SqlCommand("select * from tablename ORDER BY [ID] DESC;", mySQLconnection);SqlDataAdapter mySqlAdapter = new SqlDataAdapter(mySqlCommand);DataSet myDataSet = new DataSet();mySqlAdapter.Fill(myDataSet);GridView1.DataSource = myDataSet;GridView1.DataBind();}