Torna al Thread
private void VisualizzaDatiInGridView(string tableName)
{
using (SqlConnection conn = new SqlConnection(stringa_di_connessione))
{
using (SqlCommand comm = new SqlCommand(string.Format ("SELECT * FROM {0}",tableName ), conn))
{
conn.Open();
SqlDataReader reader = comm.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
if (reader.HasRows)
{
GridView1.AutoGenerateColumns = true;
GridView1.DataSource = reader;
GridView1.DataBind();
}
}
}
}