reading Ms Access using Ado.net, Datastructure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ramborod
    New Member
    • May 2013
    • 2

    reading Ms Access using Ado.net, Datastructure

    I am reading a database (Ms Access) in C#. I am using Ado.net for connection. This database has lot of tables (around 100) and each and every table has around 50 columns and 500 rows. Each and every field contain different data type (integer, string, bool). What I have to do is I have to convert selected tables and fields to binary format.

    After some literature survey I have planned to read the data by using 'DataReader' since I need to read the variables only for the binary conversion.

    My question is

    In C# programming side what should be my data structure? Say If I create separate classes for all tables and define the member variables and methods, How I can make it more effective?. Because I have mentioned there are 100 tables and 50 fields, Actually I don't need to select all the fields (I have to select the required ones only). I don't want to hard code it like (For example)

    SELECT BusinessEntityI D, LoginID, NationalIDNumbe r from table1Name

    Because I have to iterate through selected tables and selected fields which is mentioned somewhere in my code. Since I am bit new to SQL, Could you please provide some hints? In another way, If I ask the question how to make the select query efficient with variables for tables and fields (Please correct me if anything wrong with this question)
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Your database looks unnormalized, you should think about normalizing it so that querying is easier.

    Comment

    • ramborod
      New Member
      • May 2013
      • 2

      #3
      Assume in case, if it is normalized what would be the optimized solution?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        If it was normalized, there would be no need to iterate through any tables.

        Comment

        • vijay6
          New Member
          • Mar 2010
          • 158

          #5
          Hey ramborod, first get all the table names from your database. And for each and every table get the field values then you can do whatever you want.

          Comment

          Working...