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. Visual Basic
  4. Check database structure for select file

Check database structure for select file

Scheduled Pinned Locked Moved Visual Basic
databasecsharpdesignquestion
5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi, I have an Ms access database file which give my user an opportunity to get it file path via OpenDialog control in VB.NET. Then I proceed the connection and SQL string to the table that I have design in Ms access. My Ms access table contain 1 table named tblTest with three field Id, Name and Sex. But sometime the user select difference database from OpenFileDialog control so the structure of database is difference. How could I write the code that check the database the user select have 1 table with 3 fields? Because I want to check the table structure before my application allow my user to continuse his/her work with it.


    A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

    G 1 Reply Last reply
    0
    • L Lost User

      Hi, I have an Ms access database file which give my user an opportunity to get it file path via OpenDialog control in VB.NET. Then I proceed the connection and SQL string to the table that I have design in Ms access. My Ms access table contain 1 table named tblTest with three field Id, Name and Sex. But sometime the user select difference database from OpenFileDialog control so the structure of database is difference. How could I write the code that check the database the user select have 1 table with 3 fields? Because I want to check the table structure before my application allow my user to continuse his/her work with it.


      A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

      G Offline
      G Offline
      gthompson2005
      wrote on last edited by
      #2

      If the file names for each file that the each user will be using are the same. I would suggest having the program recognizing that file name, and acting upon that.

      L 1 Reply Last reply
      0
      • G gthompson2005

        If the file names for each file that the each user will be using are the same. I would suggest having the program recognizing that file name, and acting upon that.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Thank you for your comment, But file name is not importance, the file could change to any valide name (but the extnesion .mdb must not change) but the structure (the number of table, field and relation structure) is the importance point. If user made a change to database structure, it would be problem when my application looking for the specific table to present the data it will have the problem.


        A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

        G 1 Reply Last reply
        0
        • L Lost User

          Thank you for your comment, But file name is not importance, the file could change to any valide name (but the extnesion .mdb must not change) but the structure (the number of table, field and relation structure) is the importance point. If user made a change to database structure, it would be problem when my application looking for the specific table to present the data it will have the problem.


          A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

          G Offline
          G Offline
          gthompson2005
          wrote on last edited by
          #4

          Well then your probably going to have some problems, as if each user as the ability to use Access to change the number,name of the tables then it could change at any point, and you'll be getting a call as to why this is happening. I'm not sure about your situation for this purpose, but i would suggest making it to where they can't change the content, and structure of the database without using your program. Then all you have to worry about doing is recognizing the names of tables and having your program act on that. The current situation, seems like it could be quite problematic if the user can change stuff regarding the database file.

          L 1 Reply Last reply
          0
          • G gthompson2005

            Well then your probably going to have some problems, as if each user as the ability to use Access to change the number,name of the tables then it could change at any point, and you'll be getting a call as to why this is happening. I'm not sure about your situation for this purpose, but i would suggest making it to where they can't change the content, and structure of the database without using your program. Then all you have to worry about doing is recognizing the names of tables and having your program act on that. The current situation, seems like it could be quite problematic if the user can change stuff regarding the database file.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Thank you very much for your valuable idea, What I have to do are check the structure of database that user select whether it is the right database that I design. The second step is prevent my database from the user if they want to change the structure. :)


            A thousand mile of journey, begin with the first step. APO-CEDC Save Children Norway-Cambodia Office

            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