Selecting table in typed dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I've populated a typed dataset and now I only want to bind one of the tables
inside to datagrid - how is this accomplished?

My code:
private void FillDataGridTDS()
{
BLTask blTask = new BLTask();
DSTaskSchedules dsTaskSchedules;
blTask.GetAllTasks(out dsTaskSchedules);
// dsTaskSchedules is holding all my tables with relation etc. And now i
only want to use one of these tables as a datasource.
dgTasks.DataSource = dsTaskSchedules;
dgTasks.DataBind();


}

This is a snippet from my presentationlayer. And I dont want to set the
datamember of the datagrid in this layer. So it's to be done in the BLL :O)

The BLL:
public void GetAllTasks(out DSTaskSchedules dsTaskSchedules)
{
dsTaskSchedules = null;

DATask daTask = new DATask();
daTask.PopulateTDSTaskSchedules(out dsTaskSchedules);
dsTaskSchedules.DataSetName
// dsTaskSchedules is holding all my tables with relation etc. And now i
only want to use one of these tables as a datasource.
}

Kind regards
 
Hi Janus,

Janus said:
Hello.
I've populated a typed dataset and now I only want to bind one of the
tables
inside to datagrid - how is this accomplished?

My code:
private void FillDataGridTDS()
{
BLTask blTask = new BLTask();
DSTaskSchedules dsTaskSchedules;
blTask.GetAllTasks(out dsTaskSchedules);
// dsTaskSchedules is holding all my tables with relation etc. And now i
only want to use one of these tables as a datasource.
dgTasks.DataSource = dsTaskSchedules;

Instead of the line above, try:
dgTasks.DataSource = dsTaskSchedules.YourTable;
 
Back
Top