What is Data Source Control with example?

 Posted by Tripati_tutu on 1/10/2011 | Category: ASP.NET Interview questions | Views: 4509 | Points: 40

With the help of Data Source Control, we can perform the data binding operation by writing some data access code. This is used to retrive a DataReader or a DataSet object from the server and you can show that retrived data in DataGrid, DropDownLIst or in ListBox.

SqlConnection con = new SqlConnection();

SqlCommand cmd = new SqlCommand("Select * from Emp", con);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

GridView1.DataSource = ds;

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response