DB Connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bNet
    New Member
    • Jun 2010
    • 7

    DB Connection

    Hi There:

    I am using netbeans on my projects I have been including conection string on my code, it makes it dificult when there are changes on the server,

    Anyone has an Idea on how can I get the connection string from a .dat file, or how can I have a class with a connection string, and how do I use that class on other classes

    Please Help
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by bNet
    Hi There:

    I am using netbeans on my projects I have been including conection string on my code, it makes it dificult when there are changes on the server,

    Anyone has an Idea on how can I get the connection string from a .dat file, or how can I have a class with a connection string, and how do I use that class on other classes

    Please Help
    You can store the connection string in a XML file as your application setting and then create a Application Settings class.. which will load all the settings for the application at application start..

    The class preferably should be a static class...
    so that properties can be easily accessible and is global across all pages or forms inside the application

    Comment

    • bNet
      New Member
      • Jun 2010
      • 7

      #3
      Thanks ThatThatGuy for your response, Can you please assit with an example on how can I read from XML for my connection string?

      Comment

      Working...