XSD Dataset and Oracle query with functions
-
Hi Gurus! I got some troubles to fill Dataset... I've added a Dataset.xsd file to my ASP.NET application. Then drag&drop some tables I want to retrieve data from. And after all I got such query select code, package1.func(domain_cd, code, 'EN') as descr from table1 The matter is that in PL/SQL developer this code works fine, but when I'm trying to run following code in C# OracleDataAdapter da = new OracleDataAdapter(sql, con); DatasetXSD= new DatasetXSD(); da.Fill(DatasetXSD, "table1"); an error occurs: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. So I want to ask - do I need to set some relations in DatasetXSD during desing-time? And is it correct to use function in query to fill Dataset, or I should make it throught nested query? (I mean select code (select row1 from table2) as descr from table1) xedom developers team
-
Hi Gurus! I got some troubles to fill Dataset... I've added a Dataset.xsd file to my ASP.NET application. Then drag&drop some tables I want to retrieve data from. And after all I got such query select code, package1.func(domain_cd, code, 'EN') as descr from table1 The matter is that in PL/SQL developer this code works fine, but when I'm trying to run following code in C# OracleDataAdapter da = new OracleDataAdapter(sql, con); DatasetXSD= new DatasetXSD(); da.Fill(DatasetXSD, "table1"); an error occurs: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. So I want to ask - do I need to set some relations in DatasetXSD during desing-time? And is it correct to use function in query to fill Dataset, or I should make it throught nested query? (I mean select code (select row1 from table2) as descr from table1) xedom developers team
I recently experienced the same problem, and I fixed it by setting up relationships between the table in your schema.xsd file. Seems like your relationships in the schema file need to match those in the database itself to resolve issues like this. Hope this helps Frank cout << "Have a nice day" << endl;
-
I recently experienced the same problem, and I fixed it by setting up relationships between the table in your schema.xsd file. Seems like your relationships in the schema file need to match those in the database itself to resolve issues like this. Hope this helps Frank cout << "Have a nice day" << endl;
ok, thanx. I have rebuild my query by adding some resaltions, so for now I am retrieving data from two tables, and I got inner join. MMy sql query looks like select t1.code, t2.name from tab1 t1, tab2 t2 where t1.code=t2.code Then I call DataAdapter.Fill(DatasetXSD); no errors occured but DatasetXSD is empty, and when I run the same query in PL/SQL Developer everething works fine... Maybe some one can tell me anoter way to fill Dataset from multiple tables correctly? xedom developers team
-
Hi Gurus! I got some troubles to fill Dataset... I've added a Dataset.xsd file to my ASP.NET application. Then drag&drop some tables I want to retrieve data from. And after all I got such query select code, package1.func(domain_cd, code, 'EN') as descr from table1 The matter is that in PL/SQL developer this code works fine, but when I'm trying to run following code in C# OracleDataAdapter da = new OracleDataAdapter(sql, con); DatasetXSD= new DatasetXSD(); da.Fill(DatasetXSD, "table1"); an error occurs: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. So I want to ask - do I need to set some relations in DatasetXSD during desing-time? And is it correct to use function in query to fill Dataset, or I should make it throught nested query? (I mean select code (select row1 from table2) as descr from table1) xedom developers team
If you have relationships established between a couple (or more) tables, your
Fill
statement won't work because you're only filling one table ("table1"). Make sure you fill the wholeDataSet
. YourSelectCommand
can contain multiple SELECT statements, delimited by semi-colons (just like in SQL). Make sure you add table mappings, though. ADataAdapter
will, by default, map to tables "Table", "Table1", "Table2", ... "TableN". See theDataAdapter.TableMappings
property for more details.Microsoft MVP, Visual C# My Articles