Can we use data reader to bind gridview?

Answer Posted / swathi

this is also same as the Dataset.
these are steps:
1. SqlConnection con=new SqlConnection(ConnectionString);
2. SqlCommand com=new SqlCommand("Select * from
TableNAme",con);
3. SqlDataReader dr;
4. con.open();
5. dr=com.ExecuteReader();
6. Datagrid1.DataSource=dr;
7. DataGrid1.DataBind();

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

  • Accomm
  • i have this code.now on server side i want to compare this id(Accommodation) value and want id i.e.Accommodation.visible=true;

    1606


    What is the difference between an abstract class and an interface?

    755


    Explain why do we use the “using” statement?

    828


    Which namespace does it belong to by default?

    795


    If any body working in Infosys, please can u give me the referense to that company because i hered that their is openings for freshers with referal..

    1728


    Can you edit data in repeater control? How?

    751


    Using com component in .net?

    809


    Explain the difference between vb and vb.net?

    800


    Explain .net framework overview?

    808


    What are code contracts?

    825


    Does .net supports destructors concept?

    1854


    Can you write a class without specifying namespace?

    840


    How to convert a .NET object into COM operabililty?

    771


    Explain what is the difference between a class and an object?

    882


    What is assemblies in .net?

    875