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

3. What goals do you have in your career?

1896


What is true about application service provider?

949


To display data in a Repeater control which template you provide?

1085


Which control has default post back is enabled(true)?

1118


What is data grid view in asp.net?

991


Can I recieve both html markup for page and code in the asp.net web page's source code portion in the web browser?

977


Describe the difference between inline and code behind - which is best in?

1115


What is difference between session and application in asp net?

1067


Is a dll file an executable?

1095


What are the asp.net security controls?

1204


How can we prevent browser from caching an aspx page?

939


Out of ASP or ASP.NET which one is stateless?

1299


What is preprocessor in .net and type, where it use?

1286


Just by seeing the signature of the bean how can you specify whether it is a stateful or stateless session bean?

1041


What is side-by-side execution? Can two applications, one using a private assembly and other using a shared assembly, be stated as side-by-side executables?

1067