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 |
How can we update records in gridview?Is there any appropriate code for it?
How can we create Tree control in asp.net?
How many types of validation are there?
What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc
Write some code using interfaces, virtual methods, and an abstract class`
What are client activated objects?
About delegates ?
How can we implement a identity (sql server) call in an asp.net page?
State differences between MVC and WebAPI
How can we inherit a static variable?
What is state management in .net?
what are the Custom controls in asp.net?