Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2012, 02:16 AM
chisoko_n chisoko_n is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 77 chisoko_n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 17 m 50 sec
Reputation Power: 4
Facebook
Connection String Setup

I am currently working on a DB application that I want to search for my database when the program starts.

My database is in the programs folder and I want it to always search for it here for instance the path should be "\db.accdb". Im using Rad Studio XE2 and I need a code I can use to do this to prevent errors when the program is moved to a different pc for example

Reply With Quote
  #2  
Old October 1st, 2012, 07:40 AM
Luthfi Luthfi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 140 Luthfi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 53 m 15 sec
Reputation Power: 2
Nowadays it is a bad call to store your data in "Programs" folder. This is due to UAC. See my article about it here: http://forum.codecall.net/topic/601...th-delphi-code/.

Regarding your problem, you must define a rule of how to find your database file. For example, you might want to store your db file in user's local application data under your custom subfolder. IF the db is not there, you must create fresh db file. Or you can warn your users and instruct them on how to get proper db file.

Another option is to allow users to change the db location. For this, you must provide a configuration gui so user can do the selection, and store the current value. You can store the value in your configuration file (.ini file for example), or in registry. I recommend to store in .ini file.

Last edited by Luthfi : October 1st, 2012 at 07:43 AM.

Reply With Quote
  #3  
Old October 1st, 2012, 12:24 PM
crossmark crossmark is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 3 crossmark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 24 sec
Reputation Power: 0
Code:
If fileExists(my_base.db)=false then
begin
      ShowMessage('Error! Not found file');
      exit;
end;
//next connect


The path will be properly stored in the registry or INI. such a choice not can trust Users

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Connection String Setup

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap