I am attempting to display data from my database into a gridview How can I assign the value to the gridview?
while (rdr.Read())
{
///Console.WriteLine(rdr[0]);
gridview1.Text = rdr[0];
}
I am attempting to display data from my database into a gridview How can I assign the value to the gridview?
while (rdr.Read())
{
///Console.WriteLine(rdr[0]);
gridview1.Text = rdr[0];
}
Try this:
gridview.datasource=cmd.ExecuteReader(); gridview.databind();