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

Describe briefly what is the role of IIS on an ASP.NET application? What does it for the same application?

1021


What is the difference between WindowsDefaultLocation and WindowsDefaultBounds?

1114


What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

957


Differentiate between client-side and server-side validations in web pages.

968


Which object encapsulates state or data of a user?

1016


Which is an advantage of application service providers?

849


Why will you usually create an aspnet user account in the database for an asp.net web application?

964


Can you nest updatepanel within each other?

928


What is postback and autopostback in asp.net?

968


What do you mean by query string?

895


What is the use of session state and application state and difference between them?

865


What is a server farm in iis?

990


How to use multiple scriptmanager controls in a web page?

1048


Give 2 examples for scenarios when routing is not applied?

993


while developing webservices if i want some users to use my webservice only how can i give security to my webservice?

1795