Page 1 of 1

Refresh of datatable with parameter in select command

Posted: Tue 27 Jan 2009 08:20
by 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.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);

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?


Matthieu de Graaf

Posted: Tue 27 Jan 2009 12:51
by Shalex
We cannot reproduce the problem with dotConnect for Oracle 5.0.20. The script for the Dept table is here: . My select command for the Dept table from dataSet11:

Code: Select all

select * from SCOTT.DEPT where deptno=:deptno1 or deptno=:deptno2

Code: Select all

      dataSet11.DEPT.SelectCommand.Parameters["deptno2"].Value = 20; //deptno1 is null
      dataSet11.DEPT.Active = true;

      dataGridView1.DataSource = dataSet11;
      dataGridView1.DataMember = "dept";
As a result, the row with deptno=20 appears in dataGridView1. Please tell us how we should modify this sample to reproduce the problem or give us your select command with the definitions of database objects you are using.

Posted: Wed 28 Jan 2009 08:37
by matthieu de graaf
Hi Shalex,

Thanks for you efforts. I've tried to reproduce this in a simple emp/dept demo. I haven't been successful yet. The issue seems to be more complicated than I thought. I'll come back to you when I'v succeeded in maken a sample application.


Matthieu de Graaf

Sample send

Posted: Wed 28 Jan 2009 14:36
by matthieu de graaf
Hi Shalex,

I managed to reproduce this issue in a simple application
I'll send you this sample shortly