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 |
when a request is made in Life cycle of ASP.NET page .
How to fetch a data from one table to another table in asp.net ?
Explain the reason why the javascript validation not run on the asp.net button but run successfully on the html button?
what is the deference between dataset and data adapter?
What is parse in asp.net?
What is difference between session and cookie?
What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?
What is difference Between Authentication and authorization?
Difference between ADO.Net 1.1 and ADO.Net 2.0 ?
Tell me what is the request flow used for asp.net mvc framework? : asp.net mvc
Explain the differences between Server-side and Client-side code?
How asp.net mvc differs from asp.net web forms? : asp.net mvc
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)