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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Auto-generating SQL to fill a DataSet

Auto-generating SQL to fill a DataSet

Scheduled Pinned Locked Moved Database
databasealgorithmstoolsxml
2 Posts 2 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.
  • G Offline
    G Offline
    GazzaJ
    wrote on last edited by
    #1

    I am writing an application where I am using strongly typed DataSets to define the DataTables and relations used in various parts of the application. I have code that takes these DataSets and converts the rows in the DataTables to objects which I then use in my application. The reason for using strongly typed DataSets is so if I change the database schema I only need to validate the DataSets to identify any mismatches at compilation time. I obviously need to fill the DataSets which is currently done by creating SqlAdapters which call stored procedures to populate the DataTables within the DataSet. This means I have to keep the stored procedures in sync with the DataSets when the schema is changed. I am trying to minimise any potential bugs and so I am looking at ways to ensure the database schema, DataSets and stored procedures are kept in sync. My current method is to use my own validation tool which performs tests on the DataSets to ensure the stored procedures correctly fill the DataSets. Given the information contained within the DataSet I was thinking that it should be possible to "auto-generate" the SQL from the DataTables and DataRelations definitions. For a simple situation like Customers and Orders this is not difficult but I was wondering if there are any libraries or tools out there which generate SQL code from a DataSet definition given the complexity that may be involved with many tables and their relationships.

    M 1 Reply Last reply
    0
    • G GazzaJ

      I am writing an application where I am using strongly typed DataSets to define the DataTables and relations used in various parts of the application. I have code that takes these DataSets and converts the rows in the DataTables to objects which I then use in my application. The reason for using strongly typed DataSets is so if I change the database schema I only need to validate the DataSets to identify any mismatches at compilation time. I obviously need to fill the DataSets which is currently done by creating SqlAdapters which call stored procedures to populate the DataTables within the DataSet. This means I have to keep the stored procedures in sync with the DataSets when the schema is changed. I am trying to minimise any potential bugs and so I am looking at ways to ensure the database schema, DataSets and stored procedures are kept in sync. My current method is to use my own validation tool which performs tests on the DataSets to ensure the stored procedures correctly fill the DataSets. Given the information contained within the DataSet I was thinking that it should be possible to "auto-generate" the SQL from the DataTables and DataRelations definitions. For a simple situation like Customers and Orders this is not difficult but I was wondering if there are any libraries or tools out there which generate SQL code from a DataSet definition given the complexity that may be involved with many tables and their relationships.

      M Offline
      M Offline
      miah alom
      wrote on last edited by
      #2

      Check this out. http://www.radsoftware.com.au/articles/usingcommandbuilder.aspx

      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