OracleDataTable + RowFilter == don't work :(

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
tsv
Posts: 13
Joined: Fri 16 Jan 2009 06:11
Location: Kiev, Ukraine
Contact:

OracleDataTable + RowFilter == don't work :(

Post by tsv » Fri 23 Jan 2009 09:15

Hi.

I have a problem with RowFilter property in OracleDataTable. If I set this my table show me nothing. Here is the code:
tWarehouseFrom = new Devart.Data.Oracle.OracleDataTable(ocWarehouseFrom);
tWarehouseFrom.Active = true;
cbWarehouseFrom.DisplayMember = "NAME_WAREHOUSE";
cbWarehouseFrom.ValueMember = "ID_WAREHOUSE";
cbWarehouseFrom.DataSource = tWarehouseFrom;
tWarehouseFrom.DefaultView.RowFilter = "ID_SHOP = " + IdShop.ToString();


but if I use this code it works fine (DataAdapter+DataSet):
odaWarehouse.Fill(dsWarehouseFrom); --
cbWarehouseFrom.DisplayMember = "NAME_WAREHOUSE";
cbWarehouseFrom.ValueMember = "ID_WAREHOUSE";
cbWarehouseFrom.DataSource = dsWarehouseFrom.Tables[0];
dsWarehouseFrom.Tables[0].DefaultView.RowFilter = "ID_SHOP = " + IdShop.ToString();

but suddenly I can't find Column by name with dsWarehouseFrom.Tables[0].Columns.IndexOf("NAME_WAREHOUSE") in this. It always returm -1. %)

Please tell me how resolve to it.

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

Post by Shalex » Fri 23 Jan 2009 12:32

Please try using our sample.
Scritp:

Code: Select all

CREATE TABLE DEPT (
  DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
  DNAME VARCHAR2(14) ,
  LOC VARCHAR2(13)
);
INSERT INTO DEPT VALUES
        (10,'ACCOUNTING','NEW YORK');
INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT VALUES
        (30,'SALES','CHICAGO');
INSERT INTO DEPT VALUES
        (40,'OPERATIONS','BOSTON');
C#:

Code: Select all

      using (OracleConnection conn = new OracleConnection("Server=ora1020;port=1525;uid=xxx;pwd=xxx;")){
        
        OracleDataTable table = new OracleDataTable("select * from dept", conn);
        table.Active = true;
        table.DefaultView.RowFilter = "DEPTNO <= 20";

        ComboBox cb = new ComboBox();
        cb.Parent = this;
        cb.ValueMember = "dname";
        cb.DisplayMember = "dname";
        cb.DataSource = table;
        
        DataGridView gv = new DataGridView();
        gv.Parent = this;
        gv.DataSource = table;
        
        // the second issue

        conn.Open();
        OracleDataAdapter adapter = new OracleDataAdapter("select * from dept", conn);
        DataSet ds = new DataSet();
        adapter.Fill(ds);
        int i = ds.Tables[0].Columns.IndexOf("dname");
        MessageBox.Show(i.ToString());
      }
Does our sample work normally?

tsv
Posts: 13
Joined: Fri 16 Jan 2009 06:11
Location: Kiev, Ukraine
Contact:

Post by tsv » Fri 23 Jan 2009 13:04

Shalex wrote:Please try using our sample.
using (OracleConnection conn = new OracleConnection("Server=ora1020;port=1525;uid=xxx;pwd=xxx;")){
OracleDataTable table = new OracleDataTable("select * from dept", conn);
table.Active = true;
table.DefaultView.RowFilter = "DEPTNO 22" I have 0 results, but if write "ID_SHOP>=22" then it show me all records. I think it isn't right.

Here is my code:

Code: Select all

  tWarehouseFrom = new Devart.Data.Oracle.OracleDataTable("select * from erp.v_shop_warehouse", Connection); //ocWarehouseFrom
  tWarehouseFrom.Active = true;
  tWarehouseFrom.DefaultView.RowFilter = "ID_SHOP>=" + IdShop.ToString();
  cbWarehouseFrom.DisplayMember = "NAME_WAREHOUSE";
  cbWarehouseFrom.ValueMember = "ID_WAREHOUSE";
  cbWarehouseFrom.DataSource = tWarehouseFrom;
Try your sample with "=" not "=".

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

Post by Shalex » Fri 23 Jan 2009 13:45

It works fine in any case: "=","","",">=","<=". I've checked its work on the 5.0.20 version of dotConnect for Oracle.

Please tell me how I should modify our sample to reproduce the problem.

tsv
Posts: 13
Joined: Fri 16 Jan 2009 06:11
Location: Kiev, Ukraine
Contact:

Post by tsv » Fri 23 Jan 2009 14:07

Shalex wrote:It works fine in any case: "=","","",">=","<=". I've checked its work on the 5.0.20 version of dotConnect for Oracle.

Please tell me how I should modify our sample to reproduce the problem.
I use Mobile version of dotConnect (Win CE 5.0), may be here is the reason? I just downloaded new version. Result is the same.

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

Post by Shalex » Fri 23 Jan 2009 15:25

dotConnect for Oracle Mobile 5.00.20.2 is checked. You can see your current version here: Tools | Oracle Mobile | About dotConnect for Oracle.
DataGrid shows correct values from the Dept table in any case. How should we modify our sample to reproduce the problem?

tsv
Posts: 13
Joined: Fri 16 Jan 2009 06:11
Location: Kiev, Ukraine
Contact:

Post by tsv » Mon 26 Jan 2009 07:08

Shalex wrote:dotConnect for Oracle Mobile 5.00.20.2 is checked. You can see your current version here: Tools | Oracle Mobile | About dotConnect for Oracle.
DataGrid shows correct values from the Dept table in any case. How should we modify our sample to reproduce the problem?
I have 5.0.20.2 too.
Yes, datagrid show me filtered rows, but why combobox not, I don't understand. %)

I'll do it with the second issue. It works. Thank you for help.

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

Post by Shalex » Mon 26 Jan 2009 11:24

We have reproduced the problem with the combobox in dotConnect for Oracle Mobile. It is fixed. Look forward to the next build that will be available in 2 weeks.

Post Reply