tags:

views:

20

answers:

1

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];
        }
+1  A: 

Try this:

gridview.datasource=cmd.ExecuteReader(); gridview.databind();

DotNetRookie