Refresh of datatable with parameter in select command
Posted: Tue 27 Jan 2009 08:20
Hi,
I've created a dataset with a datatable with a parameter for the select command.
I fill the datatable with data based on parameter 1 => data is shown
I fill the datatable with data based on parameter 2 => no data is shown
My code was the following:
myDataTable.SelectCommand.Parameters["MyParam"].Value = myValue;
myDataTable.Clear();
myDataTable.Active = true;
After some research I found that the problem lies in the fact that for the second time the current row in the DataTable isn't set.
I had to add the following code:
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(myDataTable);
view.MoveCurrentToFirst();
Shouldn't this code be included in the setting of the Active property of the DataTable. In other words: Shouldn't this be a feature of DotConnect for Oracle?
Regards,
Matthieu de Graaf
I've created a dataset with a datatable with a parameter for the select command.
I fill the datatable with data based on parameter 1 => data is shown
I fill the datatable with data based on parameter 2 => no data is shown
My code was the following:
myDataTable.SelectCommand.Parameters["MyParam"].Value = myValue;
myDataTable.Clear();
myDataTable.Active = true;
After some research I found that the problem lies in the fact that for the second time the current row in the DataTable isn't set.
I had to add the following code:
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(myDataTable);
view.MoveCurrentToFirst();
Shouldn't this code be included in the setting of the Active property of the DataTable. In other words: Shouldn't this be a feature of DotConnect for Oracle?
Regards,
Matthieu de Graaf