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?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many design patterns can be created in .net?

1010


What are the challenging issues you have faced in implementation project/Maintainance project in .net Functionality? How you have overcome that issue?

5105


Explain about Behavioral design pattern?

1084


What is the difference between task and thread in .net?

1068


What is gac in .net?

1056


What is loosely coupled solution in.net?

981


How do you turn off cookies for one page in your site? Give an example.

953


Why is .net used?

999


I want to serialize instances of my class. Should I use xmlserializer, soapformatter or binaryformatter?

1055


Explain the difference between the while and for loop.

986


What data providers available in .net to connect to database?

975


With these events, why wouldn't microsoft combine invalidate and paint, so that you wouldn't have to tell it to repaint, and then to force it to repaint?

999


What does jit compilation do in .net?

1047


What are situations when you register .NET assembly in GAC ?

1075


How do you instantiate a complex number?

1062