Thread: Database

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    Database

    After making a DataSet and TableAdapter for my access or SQL database file. Where should we place the address of database file. Currently my program works only if database file is in exe folder. What if it is not local?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    perhaps you can add the file as a resource, or integrate a file dialog or something to load the file.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    I guess this is a perfect example for a config file.

    Real short example : http://www.ajaxline.com/node/258

    Short example: http://www.ezzylearning.com/tutorial.aspx?tid=8067328
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #4
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    All of the writings in config files and cs files about data access (database, dataset, datatable) are done by VS designer. There it puts a "|DataDirectory|" in connection string. In run time this phrase will be mapped to working directory instead of my database file directory.

    I should not change the designer-generated code. But I did and replaced "|DataDirectory|" by my database file path. Now program works correctly. But there should be another way to tell the designer to do so, I think!
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    From a thred in MSDN forum. I learned:
    -DataDirectory is a property of ApplicationDeployment in System.Deployment.Application NameSpace. But with only get accessor.
    -We should set it when the program starts with
    Code:
    AppDomain.CurrentDomain.SetData("DataDirectory", @"C:\DatabasePath...");
    I don't know why it is not documented in MSDN or maybe I just can't find it.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. literature database: help with planning
    By officedog in forum C++ Programming
    Replies: 1
    Last Post: 01-23-2009, 12:34 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Replies: 10
    Last Post: 05-18-2006, 11:23 PM
  4. Developing database management software
    By jdm in forum C++ Programming
    Replies: 4
    Last Post: 06-15-2004, 04:06 PM
  5. Making a Simple Database System
    By Speedy5 in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 10:17 PM

Tags for this Thread