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

Answers were Sorted based on User's Feedback



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

Answer / alb.shah

Creating a Database Connection at Run Time
Create the data connection object.
Create a data adapter object.
Create a data set object.
Invoke methods on the adapter object to fill or update the
data set.
Use data binding or another technique to display the data
from the data set.

Is This Answer Correct ?    5 Yes 0 No

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

Answer / kaarthikeyan

establish a connection and declare sqldataadapter,dataset
sda=new sqldataadapter("select the appropriate
table",connectionobj);
ds=new dataset();
sda.fill(ds);
gridview1.datasource=ds;
gridview1.databind();

Is This Answer Correct ?    3 Yes 0 No

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

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

More ASP.NET Interview Questions

WHAT IS THE SEQUENCE IN WHICH ASP.NET EVENTS IS PROCEED?

4 Answers  


How do you sign out from forms authentication?

0 Answers   MCN Solutions,


What is boxing and unboxing ?

7 Answers   Accenture, Infosys, MedTek,


What is asp short for?

0 Answers  


WHAT IS polymorphism

2 Answers   Fidelity,


How do u declare static variable and how it is declared and what is its lifetime?

0 Answers  


Explain server side state management system.

0 Answers  


What is difference between machine.config and Web.Config?

4 Answers   Accenture, BirlaSoft, Le Logiciel,


What event handlers can I include in Global.asax ?

1 Answers  


What are the media types of http requests and response?

0 Answers  


If you are using two select queries and retrieving data. how do you access second query's result set using data reader?

1 Answers   Cap Gemini, Keane India Ltd, MindSquare,


Can I read the hard disk serial # of the client computer using asp.net?

0 Answers  


Categories