Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. XSD Dataset and Oracle query with functions

XSD Dataset and Oracle query with functions

Scheduled Pinned Locked Moved C#
csharpdatabaseasp-netoraclecom
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex Getman
    wrote on last edited by
    #1

    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

    F H 2 Replies Last reply
    0
    • A Alex Getman

      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

      F Offline
      F Offline
      frank21
      wrote on last edited by
      #2

      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;

      A 1 Reply Last reply
      0
      • F frank21

        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;

        A Offline
        A Offline
        Alex Getman
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • A Alex Getman

          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

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          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 whole DataSet. Your SelectCommand can contain multiple SELECT statements, delimited by semi-colons (just like in SQL). Make sure you add table mappings, though. A DataAdapter will, by default, map to tables "Table", "Table1", "Table2", ... "TableN". See the DataAdapter.TableMappings property for more details.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups