con.Open(); SqlCommand cmd = new SqlCommand("Select code,Name,Salary,desc FROM tableName", con); SqlDataReader dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); con.Close();