I am using Sql database (.mdf) in winform. I need to know which is best method to show data in gridview? Or is there any option i can use other than gridview to show data. My data is simple text and numbers.
Currently i am manually adding row to datagridview. Code is below.
SqlConnection cn = new SqlConnection(connection_string);
SqlCommand cmd = new SqlCommand();
SqlDataReader dr;
cmd.CommandText = connection_string;
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
//Adding row manually to gridview
}
}