OracleDataTable + RowFilter == don't work :(
OracleDataTable + RowFilter == don't work :(
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.
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.
Please try using our sample.
Scritp:
C#:
Does our sample work normally?
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');
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());
}
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:Try your sample with "=" not "=".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;
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 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 have 5.0.20.2 too.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?
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.