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. ADO.NET related question

ADO.NET related question

Scheduled Pinned Locked Moved Database
databasequestioncsharpsql-serveroracle
4 Posts 4 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.
  • I Offline
    I Offline
    Imtiaz Murtaza
    wrote on last edited by
    #1

    Friends, i've found a question with few choices on a newsgrop. I dont know the answer of this question. Please tell me the answer of this question and also tell me the reason. You are writing an application that is initially designed to use an Oracle database. You know that there is a good chance that your company will be changing their corporate standard database platform to Microsoft SQL Server in the near future. You are concerned that your application needs to function with a minimum of changes if the database platform ever changes from Oracle to SQL Server. Given the scenario above, how do you declare your DataReader objects to minimize the impact of a change to the database platform in the future? 1) OracleDataReader myReader = myCommand.ExecuteReader(); 2) OleDbDataReader myReader = myCommand.ExecuteReader(); 3) SQLDataReader myReader = myCommand.ExecuteReader(); 4) OdbcDataReader myReader = myCommand.ExecuteReader(); 5) IDataReader myReader = myCommand.ExecuteReader();

    Imtiaz

    C H 2 Replies Last reply
    0
    • I Imtiaz Murtaza

      Friends, i've found a question with few choices on a newsgrop. I dont know the answer of this question. Please tell me the answer of this question and also tell me the reason. You are writing an application that is initially designed to use an Oracle database. You know that there is a good chance that your company will be changing their corporate standard database platform to Microsoft SQL Server in the near future. You are concerned that your application needs to function with a minimum of changes if the database platform ever changes from Oracle to SQL Server. Given the scenario above, how do you declare your DataReader objects to minimize the impact of a change to the database platform in the future? 1) OracleDataReader myReader = myCommand.ExecuteReader(); 2) OleDbDataReader myReader = myCommand.ExecuteReader(); 3) SQLDataReader myReader = myCommand.ExecuteReader(); 4) OdbcDataReader myReader = myCommand.ExecuteReader(); 5) IDataReader myReader = myCommand.ExecuteReader();

      Imtiaz

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      #5 - It is the interface that all others DataReaders are required to implement. However, the question does not guide you in the correct direction. You should create a DAL (Data Abstraction Layer) that can be swapped out when you change database vendor. The DAL is your application's interface to the database and only the DAL needs to care what the back end database is. Using just the interfaces supplied in System.Data isn't going to do much for you because you still need to construct the Connection, Command and DataAdapter objects which are database specific.


      Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      D 1 Reply Last reply
      0
      • I Imtiaz Murtaza

        Friends, i've found a question with few choices on a newsgrop. I dont know the answer of this question. Please tell me the answer of this question and also tell me the reason. You are writing an application that is initially designed to use an Oracle database. You know that there is a good chance that your company will be changing their corporate standard database platform to Microsoft SQL Server in the near future. You are concerned that your application needs to function with a minimum of changes if the database platform ever changes from Oracle to SQL Server. Given the scenario above, how do you declare your DataReader objects to minimize the impact of a change to the database platform in the future? 1) OracleDataReader myReader = myCommand.ExecuteReader(); 2) OleDbDataReader myReader = myCommand.ExecuteReader(); 3) SQLDataReader myReader = myCommand.ExecuteReader(); 4) OdbcDataReader myReader = myCommand.ExecuteReader(); 5) IDataReader myReader = myCommand.ExecuteReader();

        Imtiaz

        H Offline
        H Offline
        Hunuman
        wrote on last edited by
        #3

        I would reccomend that you use the Data Access Application Block (DAAB) which is free from MS. This provides the level of abstraction you need to make changing your DB backend painless.

        if (ToErr == Human.Nature) { Forgive = Divine; }

        1 Reply Last reply
        0
        • C Colin Angus Mackay

          #5 - It is the interface that all others DataReaders are required to implement. However, the question does not guide you in the correct direction. You should create a DAL (Data Abstraction Layer) that can be swapped out when you change database vendor. The DAL is your application's interface to the database and only the DAL needs to care what the back end database is. Using just the interfaces supplied in System.Data isn't going to do much for you because you still need to construct the Connection, Command and DataAdapter objects which are database specific.


          Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

          D Offline
          D Offline
          Damodar Periwal
          wrote on last edited by
          #4

          You may create a simplified and database-agnostic solution using an object-relational mapping product like NJDX. Even developing a DAL layer can get quite complicated if you have to use SQL/ADO.NET. This report shows how NJDX OR-Mapper reduced the complexity and size (70%) of the DAL code for the famous .NET Pet Shop project.

          -- Damodar Periwal Software Tree, Inc. Simplify Data Integration

          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