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

when a request is made in Life cycle of ASP.NET page .

0 Answers  


How to fetch a data from one table to another table in asp.net ?

0 Answers   MCN Solutions,


Explain the reason why the javascript validation not run on the asp.net button but run successfully on the html button?

0 Answers  


what is the deference between dataset and data adapter?

4 Answers   TCS,


What is parse in asp.net?

0 Answers  


What is difference between session and cookie?

0 Answers  


What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

0 Answers   MindCracker,


What is difference Between Authentication and authorization?

0 Answers   MCN Solutions,


Difference between ADO.Net 1.1 and ADO.Net 2.0 ?

1 Answers   Value Labs,


Tell me what is the request flow used for asp.net mvc framework? : asp.net mvc

0 Answers  


Explain the differences between Server-side and Client-side code?

2 Answers  


How asp.net mvc differs from asp.net web forms? : asp.net mvc

0 Answers  


Categories