Step 2:
- Create the DataAdapter, DataSet object. Execute the query and fill the DataSet object.
Ex -
//Create the Connection object.
OleDbConnection oConnection = new OleDbConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]);
//Create the Command object.
OleDbCommand oCommand = new OleDbCommand(selectQueryForControlPopulation , oConnection );
//Create the DataAdapter object and set its property.
OleDbDataAdapter oAdapter = new OleDbDataAdapter();
oAdapter .SelectCommand = oCommandPopulateOrganizations;
// Create a DataSet object.
DataSet oDataSet = new DataSet();
//Filling the DataSet object.
oAdapter .Fill(oDataSet);
(**) The DataSet object contain the result of different queries as different tables. We can access those table to fill our controls.