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. DB location string + SQL qweries

DB location string + SQL qweries

Scheduled Pinned Locked Moved Visual Basic
databasecsharpwindows-adminarchitecture
5 Posts 2 Posters 1 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.
  • X Offline
    X Offline
    xelk
    wrote on last edited by
    #1

    Hello, I'm building a little VB.NET application who will connect to an Access DB to fill its fields. I would like to know two things to build my architecture in the right path. 1- Is it a good idea to store the databse location in a registry key (Microsoft.Win32.Registry.CurrentUser)? If not, where should I store it? 2- To access tables in the database, I plan to create, lets say, an SQLAgent class (a layer) between my application and the DB to do any transactions (SELECT, UPDATE, DELETE, ...). This SQLAgent could run any SQL qwery passed in parameter. The constructor of this SQLAgent class would receive the DB location string to open the DB. Then this SQLAgent object, once created, would receive the SQL qwery to run and return the current recordset. When this transaction is done, this SQLAgent object can be deleted (finalized). And the VB form can fill its fields with the content of the recordset. So every forms would have control over its own SQL string and call SQLAgent whenever it need it. My point is, am I right with #1 and #2? Thank you very much, I am used with OO but it is the first time I plan to access to DB and I want to do it the right way. Because this is a personal project but I want my code to be reusable, so best practice is the best. Xelk

    V 1 Reply Last reply
    0
    • X xelk

      Hello, I'm building a little VB.NET application who will connect to an Access DB to fill its fields. I would like to know two things to build my architecture in the right path. 1- Is it a good idea to store the databse location in a registry key (Microsoft.Win32.Registry.CurrentUser)? If not, where should I store it? 2- To access tables in the database, I plan to create, lets say, an SQLAgent class (a layer) between my application and the DB to do any transactions (SELECT, UPDATE, DELETE, ...). This SQLAgent could run any SQL qwery passed in parameter. The constructor of this SQLAgent class would receive the DB location string to open the DB. Then this SQLAgent object, once created, would receive the SQL qwery to run and return the current recordset. When this transaction is done, this SQLAgent object can be deleted (finalized). And the VB form can fill its fields with the content of the recordset. So every forms would have control over its own SQL string and call SQLAgent whenever it need it. My point is, am I right with #1 and #2? Thank you very much, I am used with OO but it is the first time I plan to access to DB and I want to do it the right way. Because this is a personal project but I want my code to be reusable, so best practice is the best. Xelk

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Hi Xelk: VB.NET facilitates .EXE.COnfig. Is'nt it? You can have the connectionstrings with ScringScrambling or some small-scale reversible encryption and store it there. What do you say? Deepak Kumar Vasudevan Personal Web: http://deepak.portland.co.uk/ I Blog At: http://deepak.blogdrive.com/

      X 1 Reply Last reply
      0
      • V Vasudevan Deepak Kumar

        Hi Xelk: VB.NET facilitates .EXE.COnfig. Is'nt it? You can have the connectionstrings with ScringScrambling or some small-scale reversible encryption and store it there. What do you say? Deepak Kumar Vasudevan Personal Web: http://deepak.portland.co.uk/ I Blog At: http://deepak.blogdrive.com/

        X Offline
        X Offline
        xelk
        wrote on last edited by
        #3

        Very good idea Deepak, Is this file editable when the package is compiled then deployed? What do you think of my point #2? Thank you Xelk

        V 1 Reply Last reply
        0
        • X xelk

          Very good idea Deepak, Is this file editable when the package is compiled then deployed? What do you think of my point #2? Thank you Xelk

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          Hi Xelk: The .EXE.Config file is a kind of plain XML file. You can read it via ConfigurationSettings.AppSettings["keyname"] in your application. Whatever is there in the Config File for the particular keyname after modifying it, post package and deployment also, would be taken. Did this attend to your query? Deepak Kumar Vasudevan Personal Web: http://www24.brinkster.com/lavanyadeepak/default.asp I Blog At: http://deepak.blogdrive.com/

          X 1 Reply Last reply
          0
          • V Vasudevan Deepak Kumar

            Hi Xelk: The .EXE.Config file is a kind of plain XML file. You can read it via ConfigurationSettings.AppSettings["keyname"] in your application. Whatever is there in the Config File for the particular keyname after modifying it, post package and deployment also, would be taken. Did this attend to your query? Deepak Kumar Vasudevan Personal Web: http://www24.brinkster.com/lavanyadeepak/default.asp I Blog At: http://deepak.blogdrive.com/

            X Offline
            X Offline
            xelk
            wrote on last edited by
            #5

            Hello Deepak, Thank you for your help. I will use this .EXE.Config file. It will be very useful. Heave a nice day. Xelk

            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