Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can we use data reader to bind gridview?

Answers were Sorted based on User's Feedback



Can we use data reader to bind gridview?..

Answer / prasanth

data reader can be used to databind gri view

void Page_Load(Object sender, EventArgs e){ String Q; Sql
command cmd; Sql DataReader dr; SqlConnection conn = new
SqlConnection(); conn.ConnectionString =
ConfigurationManager.ConnectionStrings
["cn"].ConnectionString.ToString(); conn.Open
(); Q = "select * from tablename";
cmd= New Sqlcommand(Q, conn); dr =
cmd.ExecuteReader();
Gridview1.DataSource = dr; Gridview1.DataBind();}

Is This Answer Correct ?    17 Yes 4 No

Can we use data reader to bind gridview?..

Answer / 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

Can we use data reader to bind gridview?..

Answer / minhaj

yes, we can bind
but datagrid can
not be backword
because DR is
forward only

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Dot Net General Interview Questions

How can you clean up objects holding resources from within the code?

2 Answers   Wipro,


Explain the .NET architecture.

9 Answers   HCL, Idhasoft, Scandent, TCS, TechnoLinks,


Will my .net app run on 64-bit windows?

0 Answers  


I am constantly writing the drawing procedures with system.drawing.graphics, but having to use the try and dispose blocks is too time-consuming with graphicsobjects. Can I automate this?

0 Answers  


How Can Creating Installation Components in .Net?

1 Answers  


what is use of learning .net? does we get good jobs based on .net?

2 Answers  


Explain the difference between managed and unmanaged code?

0 Answers  


1 mor thing guyz....can i go for C# directly without C++ /JAVA knowledge for dot net ..???

3 Answers  


Differentiate between managed and unmanaged code?

0 Answers  


Best Dot Net Center in Chennai ?

1 Answers  


What is an anonymous method?

0 Answers  


why do you want to join deloitte, where do you exactly fit in.

1 Answers   Deloitte,


Categories