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. Database & SysAdmin
  3. Database
  4. NETTable creation through ADO.NET?

NETTable creation through ADO.NET?

Scheduled Pinned Locked Moved Database
questioncsharpdatabase
3 Posts 2 Posters 5 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.
  • D Offline
    D Offline
    Dr Herbie
    wrote on last edited by
    #1

    Hi, My question for all you ADO.NET gurus is: Is there a database-agnostic way to create a set of new tables through ADO.NET. This is the sort of thing that I would have used ADOX for prior to .NET, but there seems no equivalent. I am working on a product that will use any database, creating the required tables on the fly if they don't exist (usually as initialisation the first time the software is run). Anybody got any bright ideas, or am I going to have to generate the correct 'CREATE TABLE' syntax for each possible database type? Dr Herbie. Remember, half the people out there have below average IQs.

    M 1 Reply Last reply
    0
    • D Dr Herbie

      Hi, My question for all you ADO.NET gurus is: Is there a database-agnostic way to create a set of new tables through ADO.NET. This is the sort of thing that I would have used ADOX for prior to .NET, but there seems no equivalent. I am working on a product that will use any database, creating the required tables on the fly if they don't exist (usually as initialisation the first time the software is run). Anybody got any bright ideas, or am I going to have to generate the correct 'CREATE TABLE' syntax for each possible database type? Dr Herbie. Remember, half the people out there have below average IQs.

      M Offline
      M Offline
      Marcel Harry
      wrote on last edited by
      #2

      what's wrong if you use this "correct 'Create Table'" syntax. i create entire databases this way. SQL-Server creates the script, and we pack this in a text file which can be read using text reader and executed using an sql Command. Can it be any simpler?

      D 1 Reply Last reply
      0
      • M Marcel Harry

        what's wrong if you use this "correct 'Create Table'" syntax. i create entire databases this way. SQL-Server creates the script, and we pack this in a text file which can be read using text reader and executed using an sql Command. Can it be any simpler?

        D Offline
        D Offline
        Dr Herbie
        wrote on last edited by
        #3

        Using scripts from SQLServer is all very well, but we have to support ALL databases; SQLServer, Oracle, FoxPro, DBase, MySQL, MS Access, etc., (including any databases not yet written) CREATE TABLE syntax is similar between different DB vendors, but not identicle. Therefore we need a vendor-agnostic method. ADOX supplied this, as the driver created the actual SQL statement to create the table from a structure you created in code. I was hoping ADO.NET would have something similar, but it doesn't look promising.:( One option would be to get SQL Server to dump out table structures as XML, then use different XSLT files to transform the XML into database specific script files, but I was hoping to avoid any of that. Ho-hum, better dig that 'Learn XSLT in one easy lesson' book out.:sigh: Dr Herbie. Remember, half the people out there have below average IQs.

        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