Link to home
Start Free TrialLog in
Avatar of UrosVidojevic
UrosVidojevicFlag for Serbia

asked on

Using data base without specifying its absolute path

1.) How I Can connect to an database without specifying the absolute path of data base file.
     I need this because I have data base and exe file in folder c:/MyProgram, and this program will not work on other people's computers because maybe they will not hold program on the same address (for example c:/Programs/MyProgram... or so).

2.) Is it ok to use M. Access data base when I work with 50 000 records?
Avatar of UrosVidojevic
UrosVidojevic
Flag of Serbia image

ASKER

information:

I am using ADO.
Avatar of Ferruccio Accalai
if you have the Application and the DB in the same location just skip the path from the connectionstring leaving just the FileName (i.e. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Persist Security Info=False).
Avatar of gary_williams
gary_williams

Table.DatabaseName := ExtractFilePath(Application.EXEName) + 'mytable.db'
ASKER CERTIFIED SOLUTION
Avatar of Wim ten Brink
Wim ten Brink
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have some problems with giving the points to Alex, because when I click accept it tells me Error

ERROR
Answer not found (ID: 11).

Do you know what's the problem?
I agree with Alex that you should retain the location of the MSAccess database between executions either in an INI file, XML config file, or in the Windows registry.  If the path is not known, allow the user to select the path, starting with the application directory.  Access can easily handle 50k rows.

If you have performance problems with your MSAccess database, look at the following as potential remedies:
* launch the JetComp.exe utility to repair and compact the database
* look at the queries you are executing.  There are often too few or too many indexes.
* also make sure that you execute as many stored queries as possible, converting your dynamic SQL into MSAccess querydefs.
* replace your MSAccess database with an MSDE database, which mimics a SQL Server.
* do some query optimization
   > retrieve only the columns you need
   > look for inefficiencies in your WHERE clause
   > look at your table join efficiencies