Refresh of datatable with parameter in select command

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
matthieu de graaf
Posts: 18
Joined: Wed 14 May 2008 12:13

Refresh of datatable with parameter in select command

Post by matthieu de graaf » 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 27 Jan 2009 12:51

We cannot reproduce the problem with dotConnect for Oracle 5.0.20. The script for the Dept table is here: http://www.devart.com/forums/viewtopic.php?t=13955 . My select command for the Dept table from dataSet11:

Code: Select all

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

Code: Select all

      dataSet11.DEPT.SelectCommand.Parameters["deptno2"].Value = 20; //deptno1 is null
      dataSet11.DEPT.Clear();
      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.

matthieu de graaf
Posts: 18
Joined: Wed 14 May 2008 12:13

Post by matthieu de graaf » Wed 28 Jan 2009 08:37

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.

Regards,

Matthieu de Graaf

matthieu de graaf
Posts: 18
Joined: Wed 14 May 2008 12:13

Sample send

Post by matthieu de graaf » Wed 28 Jan 2009 14:36

Hi Shalex,

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

Regards,

Matthieu

Post Reply