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...

ADO.Net - how to get data from database and bind to the
controls -- write this small code

Answer Posted / kinjal panchal

first of all write namespace in your page.
using Syste.data.sqlclient;

//code
sqlconnection cn=new sqlconnection();
cn.open();
sqlcommand cmm=new sqlcommand("write select query here",cn);
sqldataAdupter da=new sqldataAdupter(cmm);
datatable dt=new datatable();
da.fill(dt);
cn.close();

suppose u have gridview control then

gridview.datasource=dt;
gridview.databind();

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we handle the error and redirect to some pages using web.config?

1641


What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc

1024


About CLR, reflection and assemblies?

1970


Explain how to prepare culture-specific formatting in .net.

968


What is session in http request?

1006


Explain the difference between asp.net mvc and asp.net webforms? : asp.net mvc

1033


How tooltip is set through code-behind in ASP.NET?

1093


What are the Types of objects in ASP

1105


In which situation can you not use a viewstate?

961


Define authentication and authorization.

1091


What is application and session in asp.net?

959


How you will handle session when deploying application in more than a server?

1102


Is react a template engine?

928


What is a nested masterpage in asp.net 2.0? Can there be a master page inside a masterpage?

899


What is redirectpermanent in asp.net?

1072