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
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 |
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 |
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 |
WHAT IS THE SEQUENCE IN WHICH ASP.NET EVENTS IS PROCEED?
How do you sign out from forms authentication?
What is boxing and unboxing ?
7 Answers Accenture, Infosys, MedTek,
What is asp short for?
WHAT IS polymorphism
How do u declare static variable and how it is declared and what is its lifetime?
Explain server side state management system.
What is difference between machine.config and Web.Config?
4 Answers Accenture, BirlaSoft, Le Logiciel,
What event handlers can I include in Global.asax ?
What are the media types of http requests and response?
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?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)